From f704b49c5972a9e40aa1f7dbe6f34a3ab7830c8d Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 6 Jan 2011 23:59:59 +0100 Subject: 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. --- src/localplayer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/localplayer.cpp') 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 -- cgit v1.2.3-70-g09d2