summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-09-22 01:47:26 +0200
committerBertram <bertram@cegetel.net>2009-09-22 01:47:26 +0200
commitb2dc67e16477f688f369f15574aba8a85cb18a40 (patch)
tree46d843a28b6ca87a94681ac1bfb79dc40943cee9 /src/localplayer.cpp
parent129cdf162b2727c8854e0c6b79d2e79906e5dcfb (diff)
downloadmana-b2dc67e16477f688f369f15574aba8a85cb18a40.tar.gz
mana-b2dc67e16477f688f369f15574aba8a85cb18a40.tar.bz2
mana-b2dc67e16477f688f369f15574aba8a85cb18a40.tar.xz
mana-b2dc67e16477f688f369f15574aba8a85cb18a40.zip
Added support for the go-through-walls case with mouse movement on TMWserv.
Also removed an (now) unuseful debug piece of information. Thanks Kage for reporting this case.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 635f7d04..6f4b6303 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -505,6 +505,21 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y)
if (!mMap->getWalk(x / 32, y / 32))
return;
+ // check if we're finding a path to the seeked destination
+ // If the path is empty... and isn't on the same tile,
+ // then, it's an unvalid one.
+ Vector playerPosition = getPosition();
+ if (((int)(playerPosition.x / 32) != x / 32)
+ || (((int)playerPosition.y / 32) != y / 32))
+ {
+ Path evaluatedPath = mMap->findPath(playerPosition.x / 32,
+ playerPosition.y / 32,
+ x / 32, y / 32,
+ getWalkMask());
+ if (evaluatedPath.empty())
+ return;
+ }
+
// Fix coordinates so that the player does not seem to dig into walls.
const int tx = x / 32;
const int ty = y / 32;