]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix excess removing bug
authorz411 <z411@omaera.org>
Sun, 28 May 2023 23:54:31 +0000 (19:54 -0400)
committerz411 <z411@omaera.org>
Mon, 29 May 2023 17:37:30 +0000 (13:37 -0400)
qcsrc/server/client.qc
qcsrc/server/clientkill.qc
qcsrc/server/teamplay.qc

index b5899c2cf6462a7620193763b0d8d08a62279b9a..7c7f5b096bb5f28f5d52d4f5ce5579c50449e8c8 100644 (file)
@@ -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
                                {
index f0959357c32fd87ec2a20fc3dc8e023d67f00d62..32c8d9faabb776478af0a07dd17601bd739ca7de 100644 (file)
@@ -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
        {
index fc05f974649d53319365dd72346aeec20cefd1c1..050667ba99b0b9e3d50a594e7aaa18f54fc64c31 100644 (file)
@@ -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;
        }