]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add missing teamplay logic to winnerteam comparison
authorz411 <z411@omaera.org>
Mon, 30 Jan 2023 11:17:17 +0000 (08:17 -0300)
committerz411 <z411@omaera.org>
Mon, 30 Jan 2023 11:17:17 +0000 (08:17 -0300)
qcsrc/server/scores.qc
qcsrc/server/scores.qh

index 67900ae95eb734a24256ca8cf197e05866a932bf..ae9da4ff30a81f098e2a683925c607d894e0eb9a 100644 (file)
@@ -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;
 }
index 7229e353a6b0dfc66dca17f4613ed223faa82f4f..f3e4bd3e6ac8979047f10bf066b7ef3e0e642bd7 100644 (file)
@@ -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