summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2008-04-18 20:39:57 +0000
committerYohann Ferreira <bertram@cegetel.net>2008-04-18 20:39:57 +0000
commitb0cdf9ffc57c43aa81187ac856d08da7e97955ba (patch)
treefac9ab3d292d3d508116f37ddff8254495a392ed /src/localplayer.cpp
parentdacb4895bd1985c1ac969767fc483f9200b343c8 (diff)
downloadmana-b0cdf9ffc57c43aa81187ac856d08da7e97955ba.tar.gz
mana-b0cdf9ffc57c43aa81187ac856d08da7e97955ba.tar.bz2
mana-b0cdf9ffc57c43aa81187ac856d08da7e97955ba.tar.xz
mana-b0cdf9ffc57c43aa81187ac856d08da7e97955ba.zip
Limited keyboard walk messages flooding to one message per 1/10 sec.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 78dac6f8..6f03a46d 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -45,6 +45,8 @@
#include "utils/tostring.h"
#include "utils/gettext.h"
+const short walkingKeyboardDelay = 100;
+
LocalPlayer *player_node = NULL;
LocalPlayer::LocalPlayer():
@@ -66,6 +68,7 @@ LocalPlayer::LocalPlayer():
mTrading(false),
mLastAction(-1), mWalkingDir(0),
mDestX(0), mDestY(0),
+ mLocalWalkTime(-1),
mExpMessageTime(0)
{
}
@@ -304,7 +307,8 @@ void LocalPlayer::setWalkingDir(int dir)
}
// If we're not already walking, start walking.
- if (mAction != WALK && dir)
+ if (mAction != WALK && dir
+ && get_elapsed_time(mLocalWalkTime) >= walkingKeyboardDelay)
{
walk(dir);
}