1
0

Fixed a possible crash in cWorld::WakeUpSimulatorsInArea().

The Y coords weren't checked.
This commit is contained in:
madmaxoft 2014-02-23 16:30:49 +01:00
parent f8586b8e9d
commit 728e3c68b6

View File

@ -805,6 +805,10 @@ void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
/// Wakes up the simulators for the specified area of blocks /// Wakes up the simulators for the specified area of blocks
void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ)
{ {
// Limit the Y coords:
a_MinBlockY = std::max(a_MinBlockY, 0);
a_MaxBlockY = std::min(a_MaxBlockY, cChunkDef::Height - 1);
cSimulatorManager * SimMgr = m_World->GetSimulatorManager(); cSimulatorManager * SimMgr = m_World->GetSimulatorManager();
int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ; int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ;
cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ); cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ);