diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 23:37:05 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-31 23:37:05 +0200 |
commit | ef48b30baaed9c6ad1782047d4e2d60d6248ad89 (patch) | |
tree | 0decd15e2664712ebfa37e519e41f008a8f4fade /src/Mobs/Monster.cpp | |
parent | Realised suggestions (diff) | |
download | cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar.gz cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar.bz2 cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar.lz cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar.xz cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.tar.zst cuberite-ef48b30baaed9c6ad1782047d4e2d60d6248ad89.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Monster.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 83003006e..aa6071515 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -130,14 +130,16 @@ void cMonster::TickPathFinding() { 0, 1}, { 0,-1}, } ; + + if ((PosY - 1 < 0) || (PosY + 2 > cChunkDef::Height) /* PosY + 1 will never be true if PosY + 2 is not */) + { + // Too low/high, can't really do anything + FinishPathFinding(); + return; + } for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) { - if ((PosY - 1 < 0) || (PosY + 1 > cChunkDef::Height) || (PosY + 2 > cChunkDef::Height)) - { - break; - } - if (IsCoordinateInTraversedList(Vector3i(gCrossCoords[i].x + PosX, PosY, gCrossCoords[i].z + PosZ))) { continue; |