summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2011-05-26 17:51:56 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2011-05-26 17:51:56 +0200
commitca2d7ad577fb08fdc353c8daaa27e9a16bf7a0a0 (patch)
tree964099820019e23300616359eecf1f17eaa9f7dc /src
parentf248dd42dca1f57a68de2af0174c57b9ad984ef9 (diff)
downloadmanaserv-ca2d7ad577fb08fdc353c8daaa27e9a16bf7a0a0.tar.gz
manaserv-ca2d7ad577fb08fdc353c8daaa27e9a16bf7a0a0.tar.bz2
manaserv-ca2d7ad577fb08fdc353c8daaa27e9a16bf7a0a0.tar.xz
manaserv-ca2d7ad577fb08fdc353c8daaa27e9a16bf7a0a0.zip
Fixing negative being positions
Reviewed-by: Jaxad0127
Diffstat (limited to 'src')
-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);
}