From 57701ac70f2b81e11eedb4c01f680e46c1abadb2 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 6 Jan 2011 12:36:14 +0100 Subject: Get rid of the server tick magic number. Reviewed-by: CodyMartin. --- src/utils/speedconv.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/utils') 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)); } -- cgit