summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)