summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2010-10-06 16:06:49 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2010-10-06 16:06:49 +0200
commit94218cc8e93ed7087c4036312fb469d0070802e3 (patch)
tree4d6fdafd0dfa97544549db7b761ae50ac819d603
parentf75c8fac584e1647745c0b5bf1fe8e50fc3209d5 (diff)
downloadmana-94218cc8e93ed7087c4036312fb469d0070802e3.tar.gz
mana-94218cc8e93ed7087c4036312fb469d0070802e3.tar.bz2
mana-94218cc8e93ed7087c4036312fb469d0070802e3.tar.xz
mana-94218cc8e93ed7087c4036312fb469d0070802e3.zip
Fixing movement with the mouse
When a player clicked on a tile in order to go to it, then he went to the wrong tile. Trivial fix.
-rw-r--r--src/gui/viewport.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index ce506ba1..0b7cc0f8 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -471,10 +471,8 @@ void Viewport::mouseDragged(gcn::MouseEvent &event)
if (mLocalWalkTime != player_node->getWalkTime())
{
mLocalWalkTime = player_node->getWalkTime();
- int destX = (event.getX() + mPixelViewX + 16) /
- mMap->getTileWidth();
- int destY = (event.getY() + mPixelViewY + 16) /
- mMap->getTileHeight();
+ int destX = (event.getX() + mPixelViewX) / mMap->getTileWidth();
+ int destY = (event.getY() + mPixelViewY) / mMap->getTileHeight();
player_node->setDestination(destX, destY);
}
}