From d29a9e427dd400ef73e395517eaad55f91e7e844 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 29 Jan 2017 12:15:31 +0100 Subject: [PATCH] Add a comment explaining the weird rounding math of TIME_ENCODE --- qcsrc/common/util.qh | 2 ++ qcsrc/server/race.qc | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) 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 -- 2.39.2