diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-07-01 22:57:29 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-11 02:34:03 +0200 |
commit | ebc1db2172d3dc1e954647fc21e80f074e6cda4b (patch) | |
tree | 4aa020517c83eb1e625b289cb20135d890f5af6e /src/net/manaserv | |
parent | 5c5e17c0b200004c6d18a51e2c02fd21d710f04f (diff) | |
download | mana-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.gz mana-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.bz2 mana-ebc1db2172d3dc1e954647fc21e80f074e6cda4b.tar.xz mana-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/net/manaserv')
-rw-r--r-- | src/net/manaserv/playerhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/playerhandler.h | 2 |
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; } |