summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r--src/ChunkMap.cpp51
1 files changed, 4 insertions, 47 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index f04af4340..491bc4752 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -757,48 +757,6 @@ void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ)
-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();
- int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ;
- cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ);
- cChunkDef::BlockToChunk(a_MaxBlockX, a_MaxBlockZ, MaxChunkX, MaxChunkZ);
- cCSLock Lock(m_CSChunks);
- for (int z = MinChunkZ; z <= MaxChunkZ; z++)
- {
- int MinZ = std::max(a_MinBlockZ, z * cChunkDef::Width);
- int MaxZ = std::min(a_MaxBlockZ, z * cChunkDef::Width + cChunkDef::Width - 1);
- for (int x = MinChunkX; x <= MaxChunkX; x++)
- {
- cChunkPtr Chunk = GetChunkNoGen(x, z);
- if ((Chunk == nullptr) || !Chunk->IsValid())
- {
- continue;
- }
- int MinX = std::max(a_MinBlockX, x * cChunkDef::Width);
- int MaxX = std::min(a_MaxBlockX, x * cChunkDef::Width + cChunkDef::Width - 1);
- for (int BlockY = a_MinBlockY; BlockY <= a_MaxBlockY; BlockY++)
- {
- for (int BlockZ = MinZ; BlockZ <= MaxZ; BlockZ++)
- {
- for (int BlockX = MinX; BlockX <= MaxX; BlockX++)
- {
- SimMgr->WakeUp(BlockX, BlockY, BlockZ, Chunk);
- } // for BlockX
- } // for BlockZ
- } // for BlockY
- } // for x - chunks
- } // for z = chunks
-}
-
-
-
-
-
void cChunkMap::MarkChunkDirty(int a_ChunkX, int a_ChunkZ)
{
cCSLock Lock(m_CSChunks);
@@ -1863,11 +1821,10 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
ForEachEntity(TNTDamageCallback);
// Wake up all simulators for the area, so that water and lava flows and sand falls into the blasted holes (FS #391):
- WakeUpSimulatorsInArea(
- bx - ExplosionSizeInt - 1, bx + ExplosionSizeInt + 1,
- MinY, MaxY,
- bz - ExplosionSizeInt - 1, bz + ExplosionSizeInt + 1
- );
+ m_World->GetSimulatorManager()->WakeUpArea(cCuboid(
+ bx - ExplosionSizeInt - 1, MinY, bz - ExplosionSizeInt - 1,
+ bx + ExplosionSizeInt + 1, MaxY, bz + ExplosionSizeInt + 1
+ ));
}