]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Change queue conditional to macro
authorz411 <z411@omaera.org>
Tue, 15 Aug 2023 19:22:55 +0000 (15:22 -0400)
committerz411 <z411@omaera.org>
Tue, 15 Aug 2023 19:22:55 +0000 (15:22 -0400)
qcsrc/server/client.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index ea690b2ad8882a0e9458402e17a504fdf0551353..c68fb845db98d7cdf32d0924fa4f6122eb941c4b 100644 (file)
@@ -2107,7 +2107,7 @@ int nJoinAllowed(entity this, entity ignore)
 
 bool queuePlayer(entity this)
 {
-       if(IsQueueNeeded(this) && !SpectatorWantsJoin(this))
+       if(IS_QUEUE_NEEDED(this) && !SpectatorWantsJoin(this))
        {
                if(autocvar_g_balance_teams)
                        TeamBalance_JoinBestTeam(this);
index f7df74baa3271b865cd62883650b23b5cbf6241b..013caab252ad44920bc319c79461edc9d4a36016 100644 (file)
@@ -234,11 +234,6 @@ bool Player_SetTeamIndex(entity player, int index)
        return true;
 }
 
-bool IsQueueNeeded(entity ignore)
-{
-       return (teamplay && autocvar_g_balance_teams_queue && !autocvar_g_campaign && AVAILABLE_TEAMS == 2 && TeamBalance_AreEqual(ignore, true));
-}
-
 entity SpectatorWantsJoin(entity this)
 {
        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
@@ -273,7 +268,7 @@ bool SetPlayerTeam(entity player, int team_index, int type)
 
                if (team_index != -1)
                {
-                       if (!IS_BOT_CLIENT(player) && IsQueueNeeded(player) && !SpectatorWantsJoin(player))
+                       if (!IS_BOT_CLIENT(player) && IS_QUEUE_NEEDED(player) && !SpectatorWantsJoin(player))
                        {
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_WANTS_TEAM), player.netname);
                                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_JOIN_PREVENT_QUEUE);
@@ -750,7 +745,6 @@ void Remove_Countdown(entity this)
                return;
        }
 
-       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MOVETOSPEC_REMOVE, playername(remove_player.netname, remove_player.team, true), remove_timeleft);
        --remove_timeleft;
        this.nextthink = time + 1;
 }
@@ -803,6 +797,8 @@ void TeamBalance_RemoveExcessPlayers(entity ignore)
                                                remove_countdown = new_pure(remove_countdown);
                                                setthink(remove_countdown, Remove_Countdown);
                                                remove_countdown.nextthink = time;
+
+                                               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MOVETOSPEC_REMOVE, playername(remove_player.netname, remove_player.team, true), remove_timeleft);
                                        }
                                }
                                else
index f677f45d7b58692d1826525d3f551edb0160e0ca..80512737520dc92b2ead02844e9842ab0c262a2b 100644 (file)
@@ -17,6 +17,10 @@ bool lockteams;
 
 .int team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
 
+#define IS_QUEUE_NEEDED(ignore) \
+       (teamplay && autocvar_g_balance_teams_queue && !autocvar_g_campaign && AVAILABLE_TEAMS == 2 \
+       && TeamBalance_AreEqual(ignore, true))
+
 // ========================== Global teams API ================================
 
 void Team_InitTeams();
@@ -116,7 +120,6 @@ enum
        TEAM_CHANGE_SPECTATOR = 4 ///< Player is joining spectators. //TODO: Remove?
 };
 
-bool IsQueueNeeded(entity ignore);
 entity SpectatorWantsJoin(entity this);
 
 /// \brief Sets the team of the player.