summaryrefslogtreecommitdiff
path: root/src/net/manaserv
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-09-13 22:31:20 +0200
commit421cfc174dca220ad092759f013fa413efb07294 (patch)
tree18a660d3b2024a5ad3ae1adc8f4c8d66ec3f2622 /src/net/manaserv
parentacc647ed2767df17c856931f721c88deef9765c8 (diff)
downloadmana-client-421cfc174dca220ad092759f013fa413efb07294.tar.gz
mana-client-421cfc174dca220ad092759f013fa413efb07294.tar.bz2
mana-client-421cfc174dca220ad092759f013fa413efb07294.tar.xz
mana-client-421cfc174dca220ad092759f013fa413efb07294.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. Reviewed-by: o11c.
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/playerhandler.cpp8
-rw-r--r--src/net/manaserv/playerhandler.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index a114da3d..d7c3dab6 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -442,4 +442,12 @@ Vector PlayerHandler::getPixelsPerTickMoveSpeed(const Vector &speed, Map *map)
return speedInTicks;
}
+int PlayerHandler::getKeyboardMoveDelay(const Vector& speed)
+{
+ int maxSpeed = std::max(speed.x, speed.y);
+ if (maxSpeed <= 0)
+ maxSpeed = 2;
+ return 1000 / maxSpeed;
+}
+
} // namespace ManaServ
diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h
index 3e3f8aad..0edb4354 100644
--- a/src/net/manaserv/playerhandler.h
+++ b/src/net/manaserv/playerhandler.h
@@ -69,6 +69,8 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
Vector getPixelsPerTickMoveSpeed(const Vector &speed, Map *map = 0);
+ int getKeyboardMoveDelay(const Vector& speed);
+
bool usePixelPrecision()
{ return true; }