diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-29 01:26:56 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-03-29 01:26:56 +0200 |
commit | 15c69030f987bd7d67fdbaf2158b2c3ae430143f (patch) | |
tree | a8ec211017aad38cd9784c1c837cada34eab3dfe /src/net/tmwa/playerhandler.cpp | |
parent | ce94f62be91c98310281b33dbc7f4b79fd4e8052 (diff) | |
download | mana-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.cpp | 9 |
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); |