From f74e44ef4ea7a56096d102c11c86542d94894f17 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 1 Mar 2023 23:06:06 -0800 Subject: [PATCH] CSMultiplayerRules: be explicit about calling NSGameRules::PlayerDisconnect() to handle player de-init --- src/server/gamerules_multiplayer.qc | 37 +++++++++-------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index 4acf10e..6b7eb70 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -30,7 +30,7 @@ CSMultiplayerRules::PlayerDisconnect(NSClientPlayer pl) if (health > 0) PlayerDeath(pl); - super::PlayerDisconnect(pl); + NSGameRules::PlayerDisconnect(pl); } void @@ -687,34 +687,19 @@ CSMultiplayerRules::CountPlayers(void) g_cs_total_t = 0; g_cs_total_ct = 0; - for (entity eFind = world; (eFind = findfloat(eFind, ::team, TEAM_T));) { - if (!(eFind.flags & FL_CLIENT)) - continue; + for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) { + if (eFind.team == TEAM_T) { + g_cs_total_t++; - g_cs_total_t++; + if (eFind.health > 0) + g_cs_alive_t++; + } else if (eFind.team == TEAM_CT || eFind.team == TEAM_VIP) { + g_cs_total_ct++; - if (eFind.health > 0) - g_cs_alive_t++; + if (eFind.health > 0) + g_cs_alive_ct++; + } } - for (entity eFind = world; (eFind = findfloat(eFind, ::team, TEAM_CT));) { - if (!(eFind.flags & FL_CLIENT)) - continue; - - g_cs_total_ct++; - - if (eFind.health > 0) - g_cs_alive_ct++; - } - for (entity eFind = world; (eFind = findfloat(eFind, ::team, TEAM_VIP));) { - if (!(eFind.flags & FL_CLIENT)) - continue; - - g_cs_total_ct++; - - if (eFind.health > 0) - g_cs_alive_ct++; - } - g_total_players = g_cs_total_t + g_cs_total_ct; }