summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-11 02:38:25 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2011-03-11 03:09:57 +0100
commit97e0a9eb170499e045c9cec23fcb2d474079c7dd (patch)
tree5be30560efa2a764559e7a862f3926693f67bd9e /src
parent8f97f46d4fc3be3b6617f0d04a8526ba9f75116f (diff)
downloadmanaserv-97e0a9eb170499e045c9cec23fcb2d474079c7dd.tar.gz
manaserv-97e0a9eb170499e045c9cec23fcb2d474079c7dd.tar.bz2
manaserv-97e0a9eb170499e045c9cec23fcb2d474079c7dd.tar.xz
manaserv-97e0a9eb170499e045c9cec23fcb2d474079c7dd.zip
Fixed Actor::setPosition to update the blockmask correctly
It was freeing the new tile rather than the previous tile. Reviewed-by: Stefan Dombrowski
Diffstat (limited to 'src')
-rw-r--r--src/game-server/actor.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/game-server/actor.cpp b/src/game-server/actor.cpp
index b9f4504b..68430bca 100644
--- a/src/game-server/actor.cpp
+++ b/src/game-server/actor.cpp
@@ -27,23 +27,21 @@
void Actor::setPosition(const Point &p)
{
- mPos = p;
-
// Update blockmap
- if (getMap())
+ if (Map *map = getMap()->getMap())
{
- Map *map = getMap()->getMap();
int tileWidth = map->getTileWidth();
int tileHeight = map->getTileHeight();
- const Point &oldP = getPosition();
- if ((oldP.x / tileWidth != p.x / tileWidth
- || oldP.y / tileHeight != p.y / tileHeight))
+ if ((mPos.x / tileWidth != p.x / tileWidth
+ || mPos.y / tileHeight != p.y / tileHeight))
{
- map->freeTile(oldP.x / tileWidth, oldP.y / tileHeight,
+ map->freeTile(mPos.x / tileWidth, mPos.y / tileHeight,
getBlockType());
map->blockTile(p.x / tileWidth, p.y / tileHeight, getBlockType());
}
}
+
+ mPos = p;
}
void Actor::setMap(MapComposite *mapComposite)