From 9955de573b963c4bb4d2d93ded0527b636edf1a7 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Mon, 4 Mar 2013 22:44:29 -0300 Subject: [PATCH] Avoid infinite loop --- src/client/map.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client/map.cpp b/src/client/map.cpp index 64e65be5..ec37d499 100644 --- a/src/client/map.cpp +++ b/src/client/map.cpp @@ -479,10 +479,16 @@ bool Map::isAwareOfPosition(const Position& pos) Position groundedPos = pos; while(groundedPos.z != m_centralPosition.z) { - if(groundedPos.z > m_centralPosition.z) + if(groundedPos.z > m_centralPosition.z) { + if(groundedPos.z == Otc::MAX_Z) // When pos == 65535,65535,15 we cant go up to 65536,65536,14 + break; groundedPos.coveredUp(); - else + } + else { + if(groundedPos.z == 0) // When pos == 0,0,0 we cant go down to -1,-1,1 + break; groundedPos.coveredDown(); + } } return m_centralPosition.isInRange(groundedPos, m_awareRange.left, m_awareRange.right,