diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-21 23:19:02 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-21 23:19:02 +0200 |
commit | fe02bf374a2f4be62d8a87fd7916bc01afd9a170 (patch) | |
tree | a355063a14938f358e8dab43350a35828f351602 /source | |
parent | Simulators are woken up after an explosion. (diff) | |
download | cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar.gz cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar.bz2 cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar.lz cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar.xz cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.tar.zst cuberite-fe02bf374a2f4be62d8a87fd7916bc01afd9a170.zip |
Diffstat (limited to '')
-rw-r--r-- | source/BlockArea.cpp | 14 | ||||
-rw-r--r-- | source/ChunkMap.cpp | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp index ca2f6a5bb..6134843bb 100644 --- a/source/BlockArea.cpp +++ b/source/BlockArea.cpp @@ -282,22 +282,22 @@ bool cBlockArea::Read(cWorld * a_World, int a_MinBlockX, int a_MaxBlockX, int a_ // Check coords validity:
if (a_MinBlockY < 0)
{
- LOGWARNING("cBlockArea:Read(): MinBlockY less than zero, adjusting to zero");
+ LOGWARNING("%s: MinBlockY less than zero, adjusting to zero", __FUNCTION__);
a_MinBlockY = 0;
}
else if (a_MinBlockY >= cChunkDef::Height)
{
- LOGWARNING("cBlockArea::Read(): MinBlockY more than chunk height, adjusting to chunk height");
+ LOGWARNING("%s: MinBlockY more than chunk height, adjusting to chunk height", __FUNCTION__);
a_MinBlockY = cChunkDef::Height - 1;
}
if (a_MaxBlockY < 0)
{
- LOGWARNING("cBlockArea:Read(): MaxBlockY less than zero, adjusting to zero");
+ LOGWARNING("%s: MaxBlockY less than zero, adjusting to zero", __FUNCTION__);
a_MaxBlockY = 0;
}
- else if (a_MinBlockY >= cChunkDef::Height)
+ else if (a_MaxBlockY >= cChunkDef::Height)
{
- LOGWARNING("cBlockArea::Read(): MaxBlockY more than chunk height, adjusting to chunk height");
+ LOGWARNING("%s: MaxBlockY more than chunk height, adjusting to chunk height", __FUNCTION__);
a_MaxBlockY = cChunkDef::Height - 1;
}
@@ -340,12 +340,12 @@ bool cBlockArea::Write(cWorld * a_World, int a_MinBlockX, int a_MinBlockY, int a // Check coords validity:
if (a_MinBlockY < 0)
{
- LOGWARNING("cBlockArea:Read(): MinBlockY less than zero, adjusting to zero");
+ LOGWARNING("%s: MinBlockY less than zero, adjusting to zero", __FUNCTION__);
a_MinBlockY = 0;
}
else if (a_MinBlockY >= cChunkDef::Height - m_SizeY)
{
- LOGWARNING("cBlockArea::Read(): MinBlockY + m_SizeY more than chunk height, adjusting to chunk height");
+ LOGWARNING("%s: MinBlockY + m_SizeY more than chunk height, adjusting to chunk height", __FUNCTION__);
a_MinBlockY = cChunkDef::Height - m_SizeY - 1;
}
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp index 30e8ac06f..be823b74a 100644 --- a/source/ChunkMap.cpp +++ b/source/ChunkMap.cpp @@ -1537,6 +1537,12 @@ bool cChunkMap::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback void cChunkMap::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY, int a_BlockZ, cVector3iArray & a_BlocksAffected) { + // Don't explode if outside of Y range (prevents the following test running into unallocated memory): + if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height)) + { + return; + } + // Don't explode if the explosion center is inside a liquid block: switch (m_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)) { @@ -1615,7 +1621,7 @@ void cChunkMap::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY } // for z } // for y } // for x - area.Write(m_World, a_BlockX - ExplosionSizeInt, a_BlockY - ExplosionSizeInt, a_BlockZ - ExplosionSizeInt); + area.Write(m_World, a_BlockX - ExplosionSizeInt, MinY, a_BlockZ - ExplosionSizeInt); // Wake up all simulators for the area, so that water and lava flows and sand falls into the blasted holes (FS #391): WakeUpSimulatorsInArea( |