From: z411 Date: Sun, 28 May 2023 23:54:31 +0000 (-0400) Subject: Fix excess removing bug X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3782bc5aa0a9c9fdbef4ecda0c4dc6ddcbcc40b9;p=xonotic%2Fxonotic-data.pk3dir.git Fix excess removing bug --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index b5899c2cf..7c7f5b096 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2691,6 +2691,8 @@ void PlayerPostThink (entity this) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING, this.netname, maxidle_time); PutObserverInServer(this, true, true); + if(autocvar_g_balance_teams_remove) + TeamBalance_RemoveExcessPlayers(this); } else { diff --git a/qcsrc/server/clientkill.qc b/qcsrc/server/clientkill.qc index f0959357c..32c8d9faa 100644 --- a/qcsrc/server/clientkill.qc +++ b/qcsrc/server/clientkill.qc @@ -29,7 +29,11 @@ void ClientKill_Now_TeamChange(entity this) if (this.wants_join) SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR); else + { PutObserverInServer(this, false, true); + if(autocvar_g_balance_teams_remove) + TeamBalance_RemoveExcessPlayers(this); + } } else { diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index fc05f9746..050667ba9 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -301,8 +301,6 @@ bool SetPlayerTeam(entity player, int team_index, int type) else if (!CS(player).just_joined && player.frags != FRAGS_SPECTATOR) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, player.netname); - if(autocvar_g_balance_teams_remove) - TeamBalance_RemoveExcessPlayers(player); } } @@ -729,7 +727,7 @@ void TeamBalance_RemoveExcessPlayers(entity ignore) for(int i = 1; i <= AVAILABLE_TEAMS; ++i) { int cur = TeamBalance_GetTeamFromIndex(balance, i).m_num_players; - if(cur < min) + if(i == 1 || cur < min) min = cur; }