summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/being.cpp4
-rw-r--r--src/localplayer.cpp15
2 files changed, 16 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp
index a1bb7f92..43f0fdef 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -203,9 +203,7 @@ void Being::clearPath()
void Being::setPath(const Path &path)
{
mPath = path;
-#ifdef TMWSERV_SUPPORT
- std::cout << this << " New path: " << path << std::endl;
-#else
+#ifdef EATHENA_SUPPORT
if (mAction != WALK && mAction != DEAD)
{
nextStep();
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;