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;
}
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