From: z411 Date: Mon, 30 Jan 2023 11:17:17 +0000 (-0300) Subject: Add missing teamplay logic to winnerteam comparison X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6e5aa330c3731cef8bcd64fff45c6bc50d6f103c;p=xonotic%2Fxonotic-data.pk3dir.git Add missing teamplay logic to winnerteam comparison --- diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 67900ae95..ae9da4ff3 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -421,12 +421,19 @@ float PlayerScore_Compare(entity t1, entity t2, bool strict) bool Score_NewLeader() { - // Returns true if the game leader has changed (no teamplay support yet) - if (teamplay) return false; - if (WinningConditionHelper_winner != WinningConditionHelper_winner_last && (WinningConditionHelper_second || WinningConditionHelper_equality)) - { - WinningConditionHelper_winner_last = WinningConditionHelper_winner; - return true; + // Returns true if the game leader has changed + if(teamplay) { + if (WinningConditionHelper_winnerteam != WinningConditionHelper_winnerteam_last && (WinningConditionHelper_secondteam || WinningConditionHelper_equality)) + { + WinningConditionHelper_winnerteam_last = WinningConditionHelper_winnerteam; + return true; + } + } else { + if (WinningConditionHelper_winner != WinningConditionHelper_winner_last && (WinningConditionHelper_second || WinningConditionHelper_equality)) + { + WinningConditionHelper_winner_last = WinningConditionHelper_winner; + return true; + } } return false; } diff --git a/qcsrc/server/scores.qh b/qcsrc/server/scores.qh index 7229e353a..f3e4bd3e6 100644 --- a/qcsrc/server/scores.qh +++ b/qcsrc/server/scores.qh @@ -112,6 +112,7 @@ void WinningConditionHelper(entity this); float WinningConditionHelper_topscore; ///< highest score float WinningConditionHelper_secondscore; ///< second highest score float WinningConditionHelper_winnerteam; ///< the color of the winning team, or -1 if none +float WinningConditionHelper_winnerteam_last; float WinningConditionHelper_secondteam; ///< the color of the second team, or -1 if none float WinningConditionHelper_equality; ///< we have no winner entity WinningConditionHelper_winner; ///< the winning player, or NULL if none