diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 21:33:33 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 21:33:33 +0200 |
commit | 0836fe9a84e59b083db368205cbf6496355378bf (patch) | |
tree | b3d5a4b35d868380c5794d2cc1ff838cf2237906 /src/Mobs/Monster.cpp | |
parent | Fixed a few clang warnings. (diff) | |
download | cuberite-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/Monster.cpp')
-rw-r--r-- | src/Mobs/Monster.cpp | 10 |
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))) |