summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-06 23:59:59 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-06 23:59:59 +0100
commitf704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d (patch)
treeb5d8ea415a0bad26adf1e167d92948c23e92a93b /src/localplayer.cpp
parent9ec38c1e381336df89e0f0eea84065cc537f9e4b (diff)
downloadmana-client-f704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d.tar.gz
mana-client-f704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d.tar.bz2
mana-client-f704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d.tar.xz
mana-client-f704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d.zip
Made the beings avoid changing direction at their path's end.
I had to let the keyboard path not be resend when the player released the movement keys and work on conditions used to update the beings direction to avoid conflicts. Resolves: Mana-mantis #154. Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a4560030..7d427b82 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -745,13 +745,10 @@ void LocalPlayer::setWalkingDir(int dir)
// Else, he is not pressing a key,
// and the current path hasn't been sent by mouse,
- // then, stop (sending to server).
+ // then let the path die (1/2 tile after that.)
+ // This permit to avoid desyncs with other clients.
else if (!dir)
- {
- if (!mPathSetByMouse)
- player_node->stopWalking(true);
return;
- }
// If the delay to send another walk message to the server hasn't expired,
// don't do anything or we could get disconnected for spamming the server
@@ -802,6 +799,10 @@ void LocalPlayer::startWalking(unsigned char dir)
if (dir & RIGHT)
dx++;
+ // Update the direction when the walk just start
+ if (Net::getNetworkType() == ServerInfo::MANASERV)
+ setDirection(dir);
+
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
{
// Prevent skipping corners over colliding tiles