summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/localplayer.cpp6
-rw-r--r--src/localplayer.h2
3 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2bd16773..3eae3868 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
src/gui/changepassworddialog.h, src/gui/changepassworddialog.cpp,
src/CMakeLists.txt: Added a change password dialog. State code is to
be reworked.
+ * src/localplayer.h, src/localplayer.cpp: limited keyboard walk message
+ flooding to one every 1/10 sec.
2008-04-18 David Athay <ko2fan@gmail.com>
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);
}
diff --git a/src/localplayer.h b/src/localplayer.h
index 75a1af7d..832b7eb4 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -367,6 +367,8 @@ class LocalPlayer : public Player
int mWalkingDir; /**< The direction the player is walking in. */
int mDestX; /**< X coordinate of destination. */
int mDestY; /**< Y coordinate of destination. */
+ int mLocalWalkTime; /**< Timestamp used to control keyboard walk
+ messages flooding */
std::list<std::string> mExpMessages; /**< Queued exp messages*/
int mExpMessageTime;