CSMultiplayerRules: be explicit about calling NSGameRules::PlayerDisconnect() to handle player de-init

This commit is contained in:
Marco Cawthorne 2023-03-01 23:06:06 -08:00
parent cb12c5d747
commit f74e44ef4e
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
1 changed files with 11 additions and 26 deletions

View File

@ -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;
}