]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix minor regression where "Sudden Death" is displayed as "Timeout #16777215" in... terencehill/sudden_death_fix 1504/head
authorterencehill <piuntn@gmail.com>
Wed, 7 May 2025 13:07:11 +0000 (15:07 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 7 May 2025 13:09:38 +0000 (15:09 +0200)
This regression was introduced by !1352

qcsrc/client/hud/panel/timer.qc
qcsrc/common/stats.qh
qcsrc/server/world.qc

index ae796fbdd3a89a626542d1d3d257d362dff9a454..bf08e603c29acc542012874b8a1eb9986e012de5 100644 (file)
@@ -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");
index 7bbc4ca6a0dbbb1f574952c40a99c4f674762b08..ed1e0d85c91039b3ad57c783cec5ebd2569ebdc6 100644 (file)
@@ -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!
index 5e4bc9c69aa3657e077e0429ade5025514b6354e..c97b3b1e4724318322df7e33bec29b05ae540608 100644 (file)
@@ -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;