summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-11-15 21:45:57 +0100
committerMattes D <github@xoft.cz>2014-11-15 21:45:57 +0100
commit1240e583d27c2189e50fda3f7ab63d736889abda (patch)
tree6f548d3d18179446c460ab3c7a823d130763d17f /src/Mobs/Monster.cpp
parentGenerator: Fixed crash with trees too high. (diff)
downloadcuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar.gz
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar.bz2
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar.lz
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar.xz
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.tar.zst
cuberite-1240e583d27c2189e50fda3f7ab63d736889abda.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 23b4d9f45..5319bdf91 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -160,7 +160,7 @@ void cMonster::TickPathFinding()
BLOCKTYPE BlockAtYP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 1, gCrossCoords[i].z + PosZ);
BLOCKTYPE BlockAtYPP = m_World->GetBlock(gCrossCoords[i].x + PosX, PosY + 2, gCrossCoords[i].z + PosZ);
int LowestY = FindFirstNonAirBlockPosition(gCrossCoords[i].x + PosX, gCrossCoords[i].z + PosZ);
- BLOCKTYPE BlockAtLowestY = m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ);
+ BLOCKTYPE BlockAtLowestY = (LowestY >= cChunkDef::Height) ? E_BLOCK_AIR : m_World->GetBlock(gCrossCoords[i].x + PosX, LowestY, gCrossCoords[i].z + PosZ);
if (
(!cBlockInfo::IsSolid(BlockAtY)) &&
@@ -453,7 +453,7 @@ int cMonster::FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ)
}
else
{
- while (cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))) && (PosY < cChunkDef::Height))
+ while ((PosY < cChunkDef::Height) && cBlockInfo::IsSolid(m_World->GetBlock((int)floor(a_PosX), PosY, (int)floor(a_PosZ))))
{
PosY++;
}