]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix inconsistent ReadyCount() calling logic
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 26 Sep 2022 05:21:33 +0000 (15:21 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 26 Sep 2022 05:21:33 +0000 (15:21 +1000)
timeout_status was checked at only 1 call site,
and readiness changes during a timeout were sometimes ignored.

ReadyCount() was sometimes called when not in warmup.

qcsrc/server/client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/vote.qc

index a1195d52cfb9ae579ec684b215e21aa3c6d60b21..5843e02a35349114d6aad6b76d59c22aa943d37d 100644 (file)
@@ -256,7 +256,7 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
                {
                        if (vote_called) { VoteCount(false); }
                        this.ready = false;
-                       recount_ready = true;
+                       if (warmup_stage) recount_ready = true;
                }
                entcs_update_players(this);
        }
@@ -307,7 +307,7 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
 
        TRANSMUTE(Observer, this);
 
-       if(recount_ready) ReadyCount();
+       if(recount_ready) ReadyCount(); // FIXME: please add comment about why this is delayed
 
        WaypointSprite_PlayerDead(this);
        accuracy_resend(this);
@@ -1236,7 +1236,7 @@ void ClientDisconnect(entity this)
        if (this.personal) delete(this.personal);
 
        this.playerid = 0;
-       ReadyCount();
+       if (warmup_stage) ReadyCount();
        if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
 
        player_powerups_remove_all(this); // stop powerup sound
index 552d870e6bc742a8d07615054b7c47f154aa5522..e2d71597f44ae1f20369a8b6c7e2e2c59f38c90e 100644 (file)
@@ -393,9 +393,7 @@ void ClientCommand_ready(entity caller, int request)
                                        }
 
                                        caller.last_ready = time;
-
-                                       // cannot reset the game while a timeout is active!
-                                       if (!timeout_status) ReadyCount();
+                                       ReadyCount();
                                }
                        }
                        return;  // never fall through to usage
index af7aeb059a63f9c438a65b06dd7cb8375a833b75..6138bd8b5b4734ed0222d0eedbbcade4b2904aeb 100644 (file)
@@ -187,6 +187,10 @@ void timeout_handler_reset(entity this)
        timeout_leadtime = 0;
 
        delete(this);
+
+       // ReadyCount() does nothing when a timeout is active or pending
+       // so check readiness now to support g_warmup_allow_timeout
+       if (warmup_stage) ReadyCount();
 }
 
 void timeout_handler_think(entity this)
index 8d2debdd50a0f49db13fa5682208cd34e80f1a9a..8c70ae6f99d328b13fdea79b026f062b6a49bb90 100644 (file)
@@ -506,6 +506,9 @@ void ReadyRestart(bool forceWarmupEnd)
 // Count the players who are ready and determine whether or not to restart the match
 void ReadyCount()
 {
+       // cannot reset the game while a timeout is active or pending
+       if (timeout_status) return;
+
        float ready_needed_factor, ready_needed_count;
        float t_players = 0;
        readycount = 0;