summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
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)