summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-07-01 22:57:29 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:34:03 +0200
commitebc1db2172d3dc1e954647fc21e80f074e6cda4b (patch)
tree4aa020517c83eb1e625b289cb20135d890f5af6e /src/localplayer.cpp
parent5c5e17c0b200004c6d18a51e2c02fd21d710f04f (diff)
downloadmana-client-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.gz
mana-client-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.bz2
mana-client-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.xz
mana-client-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.zip
Made the delay between to keyboard move calls functional.
It has been fixed and be made adapted to the being movement speed. Now, for instance, the client sends 3x times less move calls to the tA server, and roughly 20x times for the Manaserv's one. Resolves: Mana-Mantis #346.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index f941dd5f..3c1cc259 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -58,11 +58,6 @@
#include <cassert>
-// This is the minimal delay between to permitted
-// setDestination() calls using the keyboard.
-// TODO: This can fine tuned later on when running is added...
-const short walkingKeyboardDelay = 1000;
-
#define AWAY_LIMIT_TIMER 60
LocalPlayer *player_node = NULL;
@@ -79,6 +74,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mWalkingDir(0),
mPathSetByMouse(false),
mLocalWalkTime(-1),
+ mKeyboardMoveDelay(500),
mMessageTime(0),
mShowIp(false),
mAwayDialog(0),
@@ -741,8 +737,9 @@ void LocalPlayer::setWalkingDir(int dir)
// 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
- if (get_elapsed_time(mLocalWalkTime) < walkingKeyboardDelay)
+ if (get_elapsed_time(mLocalWalkTime) < mKeyboardMoveDelay)
return;
+ mLocalWalkTime = tick_time;
mWalkingDir = dir;
@@ -808,6 +805,12 @@ void LocalPlayer::stopWalking(bool sendToServer)
clearPath();
}
+void LocalPlayer::setMoveSpeed(const Vector& speed)
+{
+ Being::setMoveSpeed(speed);
+ mKeyboardMoveDelay = Net::getPlayerHandler()->getKeyboardMoveDelay(speed);
+}
+
void LocalPlayer::toggleSit()
{
if (mLastAction != -1)