diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-03 19:31:33 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-03 19:31:33 +0100 |
commit | 352056c23c6258c7acbd9593eacdf1e4bfef3e9e (patch) | |
tree | 95ae2feadaa4fff4ebde977e5fb9f1a1b8fe3b32 /src/utils/speedconv.cpp | |
parent | 6bb8e30f5afc1c77987d8fdef71df880e72db151 (diff) | |
download | manaserv-352056c23c6258c7acbd9593eacdf1e4bfef3e9e.tar.gz manaserv-352056c23c6258c7acbd9593eacdf1e4bfef3e9e.tar.bz2 manaserv-352056c23c6258c7acbd9593eacdf1e4bfef3e9e.tar.xz manaserv-352056c23c6258c7acbd9593eacdf1e4bfef3e9e.zip |
Cleaned up and document a bit more the speed conversion functions.
Trivial fix.
Diffstat (limited to 'src/utils/speedconv.cpp')
-rw-r--r-- | src/utils/speedconv.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/utils/speedconv.cpp b/src/utils/speedconv.cpp index f6be2e7b..29ab059c 100644 --- a/src/utils/speedconv.cpp +++ b/src/utils/speedconv.cpp @@ -20,12 +20,20 @@ #include "utils/speedconv.h" -double utils::tpsToSpeed(double tps) +#include "defines.h" + +// Defines the max base scale used to compute the raw speed system. +// The raw speed is the number of tile moves per server tick * 100 +// since a server tick is currently 100 ms. +// TODO: Deharcode the magic value by obtaining the server tick time. +#define MAX_MOVE_TIME 32000 + +double utils::tpsToRawSpeed(double tps) { - return (32000 / (tps * DEFAULT_TILE_LENGTH)); + return (MAX_MOVE_TIME / (tps * DEFAULT_TILE_LENGTH)); } -double utils::speedToTps(double speed) +double utils::rawSpeedToTps(double speed) { - return (32000 / (speed * DEFAULT_TILE_LENGTH)); + return (MAX_MOVE_TIME / (speed * DEFAULT_TILE_LENGTH)); } |