From: terencehill Date: Sun, 29 Jan 2017 11:15:31 +0000 (+0100) Subject: Add a comment explaining the weird rounding math of TIME_ENCODE X-Git-Tag: xonotic-v0.8.2~261 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d29a9e427dd400ef73e395517eaad55f91e7e844;p=xonotic%2Fxonotic-data.pk3dir.git Add a comment explaining the weird rounding math of TIME_ENCODE --- diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 05e4a4ea2..8a471d594 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -49,6 +49,8 @@ void db_put(int db, string key, string value); int buf_load(string filename); void buf_save(int buf, string filename); +// adding just 0.4 for race times so it rounds down in the .5 case (matching the timer display) +// FIXME it doesn't round properly #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4) string format_time(float seconds); string mmsss(float t); diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index a90ef8f95..84afa1144 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -368,7 +368,6 @@ void race_SendTime(entity e, float cp, float t, float tvalid) t += e.race_penalty_accumulator; t = TIME_ENCODE(t); // make integer - // adding just 0.4 so it rounds down in the .5 case (matching the timer display) if(tvalid) if(cp == race_timed_checkpoint) // finish line