From: terencehill Date: Wed, 7 May 2025 13:07:11 +0000 (+0200) Subject: Fix minor regression where "Sudden Death" is displayed as "Timeout #16777215" in... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F1504%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Fix minor regression where "Sudden Death" is displayed as "Timeout #16777215" in the HUD This regression was introduced by !1352 --- diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index ae796fbdd3..bf08e603c2 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -137,7 +137,7 @@ void HUD_Timer() } else if(STAT(TIMEOUT_STATUS) == 2) subtext = _("Timeout"); - else if (overtimes == -1) + else if (overtimes == BITS(24)) subtext = _("Sudden Death"); else if(overtimes == 1) subtext = _("Overtime"); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 7bbc4ca6a0..ed1e0d85c9 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -79,7 +79,7 @@ float game_stopped; float game_starttime; //point in time when the countdown to game start is over float round_starttime; //point in time when the countdown to round start is over int autocvar_leadlimit; -int overtimes; // overtimes added (-1 = sudden death) +int overtimes; // overtimes added (if set to BITS(24) (max int that can be sent) = sudden death) int timeout_status; // (values: 0, 1, 2) contains whether a timeout is not active (0), was called but still at leadtime (1) or is active (2) // TODO: world.qh can't be included here due to circular includes! diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 5e4bc9c69a..c97b3b1e47 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -1467,7 +1467,7 @@ int InitiateSuddenDeath() else { checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath; - overtimes = -1; + overtimes = BITS(24); // sudden death } if(g_race && !g_race_qualifying) race_StartCompleting(); @@ -1479,6 +1479,8 @@ int InitiateSuddenDeath() void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true { ++checkrules_overtimesadded; + // NOTE: here overtimes can never be < 0 so it can be safely sent as int stat; we ignore + // the upper limit of BITS(24) - 1 = 16777215 - 1 that in practice can never be reached in game overtimes = checkrules_overtimesadded; //add one more overtime by simply extending the timelimit cvar_set("timelimit", ftos(autocvar_timelimit + autocvar_timelimit_overtime)); @@ -1827,7 +1829,7 @@ void CheckRules_World() if(checkrules_status == WINNING_YES) { - if (overtimes == -1 && overtimes != overtimes_prev) + if (overtimes == BITS(24) && overtimes != overtimes_prev) { // if suddendeathend overtime has just begun, revert it checkrules_suddendeathend = 0;