From: z411 Date: Tue, 15 Aug 2023 19:22:55 +0000 (-0400) Subject: Change queue conditional to macro X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9b05841a2b2f5c5ecc73f3acfde2011eceb045dc;p=xonotic%2Fxonotic-data.pk3dir.git Change queue conditional to macro --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index ea690b2ad..c68fb845d 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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); diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index f7df74baa..013caab25 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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 diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index f677f45d7..805127375 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -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.