summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-31 21:33:33 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-31 21:33:33 +0200
commit0836fe9a84e59b083db368205cbf6496355378bf (patch)
treeb3d5a4b35d868380c5794d2cc1ff838cf2237906 /src/Mobs
parentFixed a few clang warnings. (diff)
downloadcuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.gz
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.bz2
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.lz
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.xz
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.tar.zst
cuberite-0836fe9a84e59b083db368205cbf6496355378bf.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Monster.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index d3e0f1c26..83003006e 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -111,9 +111,9 @@ void cMonster::SpawnOn(cClientHandle & a_Client)
void cMonster::TickPathFinding()
{
- int PosX = (int)floor(GetPosX());
- int PosY = (int)floor(GetPosY());
- int PosZ = (int)floor(GetPosZ());
+ const int PosX = (int)floor(GetPosX());
+ const int PosY = (int)floor(GetPosY());
+ const int PosZ = (int)floor(GetPosZ());
m_FinalDestination.y = (double)FindFirstNonAirBlockPosition(m_FinalDestination.x, m_FinalDestination.z);
@@ -133,9 +133,9 @@ void cMonster::TickPathFinding()
for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++)
{
- if ((gCrossCoords[i].x + PosX == PosX) && (gCrossCoords[i].z + PosZ == PosZ))
+ if ((PosY - 1 < 0) || (PosY + 1 > cChunkDef::Height) || (PosY + 2 > cChunkDef::Height))
{
- continue;
+ break;
}
if (IsCoordinateInTraversedList(Vector3i(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ)))