summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;