summaryrefslogtreecommitdiff
path: root/src/net/tmwa/playerhandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-29 01:26:56 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-29 01:26:56 +0200
commit15c69030f987bd7d67fdbaf2158b2c3ae430143f (patch)
treea8ec211017aad38cd9784c1c837cada34eab3dfe /src/net/tmwa/playerhandler.cpp
parentce94f62be91c98310281b33dbc7f4b79fd4e8052 (diff)
downloadmana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.gz
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.bz2
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.tar.xz
mana-15c69030f987bd7d67fdbaf2158b2c3ae430143f.zip
Added the Map::getTileCenter() convenience function.
and made use of it through the tA code. I also remove the obsolete TODO in the flooritem class.
Diffstat (limited to 'src/net/tmwa/playerhandler.cpp')
-rw-r--r--src/net/tmwa/playerhandler.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 9d97dc73..f7a211d1 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -202,21 +202,18 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
/* Scroll if necessary */
Map *map = game->getCurrentMap();
- int tileWidth = map->getTileWidth();
- int tileHeight = map->getTileHeight();
int tileX = player_node->getTileX();
int tileY = player_node->getTileY();
if (!sameMap
|| (abs(x - tileX) > MAP_TELEPORT_SCROLL_DISTANCE)
|| (abs(y - tileY) > MAP_TELEPORT_SCROLL_DISTANCE))
{
- scrollOffsetX = (x - tileX) * tileWidth;
- scrollOffsetY = (y - tileY) * tileHeight;
+ scrollOffsetX = (x - tileX) * map->getTileWidth();
+ scrollOffsetY = (y - tileY) * map->getTileHeight();
}
player_node->setAction(Being::STAND);
- Vector pos(x * tileWidth + tileWidth / 2,
- y * tileHeight + tileHeight / 2);
+ Vector pos = map->getTileCenter(x, y);
player_node->setPosition(pos);
// Stop movement
player_node->setDestination(pos.x, pos.y);