summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-06 12:36:14 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-06 12:36:14 +0100
commit57701ac70f2b81e11eedb4c01f680e46c1abadb2 (patch)
treef75159985b58c87a39fe7d602a2e94acdbb0ccbd /src/utils
parent8404033af0218ccd0221bf6ae9c0939bec86c4c9 (diff)
downloadmanaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.tar.gz
manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.tar.xz
manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.zip
Get rid of the server tick magic number.
Reviewed-by: CodyMartin.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/speedconv.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/utils/speedconv.cpp b/src/utils/speedconv.cpp
index 29ab059..cbea2c1 100644
--- a/src/utils/speedconv.cpp
+++ b/src/utils/speedconv.cpp
@@ -23,17 +23,16 @@
#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
+// The raw speed is the number of tile moves per server tick multiplied the
+// server tick value in miliseconds.
+#define MAX_MOVE_TIME 320
double utils::tpsToRawSpeed(double tps)
{
- return (MAX_MOVE_TIME / (tps * DEFAULT_TILE_LENGTH));
+ return ((MAX_MOVE_TIME * WORLD_TICK_MS) / (tps * DEFAULT_TILE_LENGTH));
}
double utils::rawSpeedToTps(double speed)
{
- return (MAX_MOVE_TIME / (speed * DEFAULT_TILE_LENGTH));
+ return ((MAX_MOVE_TIME * WORLD_TICK_MS) / (speed * DEFAULT_TILE_LENGTH));
}