diff options
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index e10fd3d6..29a2a54b 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -178,7 +178,7 @@ void LocalPlayer::walk(unsigned char dir) if (action == WALK) { - // Avoid sending the coordinates to the server + // Just finish the current action, otherwise we get out of sync Being::setDestination(x, y); return; } @@ -203,8 +203,7 @@ void LocalPlayer::walk(unsigned char dir) if (dx && dy && !mMap->getWalk(x + dx, y + dy)) dx = 0; - // Walk to where the player can actually go - if ((dx || dy) && mMap->getWalk(x + dx, y + dy)) + if (dx || dy) { setDestination(x + dx, y + dy); } @@ -218,6 +217,10 @@ void LocalPlayer::walk(unsigned char dir) void LocalPlayer::setDestination(Uint16 x, Uint16 y) { + // Check if we can walk there + if (!mMap->getWalk(x, y)) + return; + char temp[3]; MessageOut outMsg(mNetwork); set_coordinates(temp, x, y, direction); |