diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-11 02:38:25 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-03-11 03:09:57 +0100 |
commit | 97e0a9eb170499e045c9cec23fcb2d474079c7dd (patch) | |
tree | 5be30560efa2a764559e7a862f3926693f67bd9e /src/game-server/actor.cpp | |
parent | 8f97f46d4fc3be3b6617f0d04a8526ba9f75116f (diff) | |
download | manaserv-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/game-server/actor.cpp')
-rw-r--r-- | src/game-server/actor.cpp | 14 |
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) |