summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game-server/monster.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp
index 9c1a87a6..8db0df69 100644
--- a/src/game-server/monster.cpp
+++ b/src/game-server/monster.cpp
@@ -324,7 +324,10 @@ void Monster::update()
- range + getPosition().x,
rand() % (range * 2 + 1)
- range + getPosition().y);
- setDestination(randomPos);
+ // Don't allow negative destinations, to avoid rounding
+ // problems when divided by tile size
+ if (randomPos.x >= 0 && randomPos.y >= 0)
+ setDestination(randomPos);
}
setTimerHard(T_M_STROLL, 10 + rand() % 10);
}