Use only the Diplomacy Color of non-defeated players

Patch By: LangBart
Differential Revision: D4288
This was SVN commit r25951.
This commit is contained in:
bb
2021-10-06 20:33:12 +00:00
parent 56f5cb9e62
commit 4640a1fd36
@@ -16,6 +16,7 @@ class DiplomacyColors
this.diplomacyColorsChangeHandlers = [];
registerPlayersInitHandler(this.onPlayersInit.bind(this));
registerPlayersFinishedHandler(this.onPlayersFinished.bind(this));
registerConfigChangeHandler(this.onConfigChange.bind(this));
registerCeasefireEndedHandler(this.onCeasefireEnded.bind(this));
}
@@ -30,6 +31,12 @@ class DiplomacyColors
this.computeTeamColors();
}
onPlayersFinished()
{
if (this.enabled)
this.updateDisplayedPlayerColors();
}
onDiplomacyChange()
{
if (this.enabled)
@@ -99,7 +106,7 @@ class DiplomacyColors
if (g_ViewedPlayer <= 0)
{
// Observers and gaia see team colors
let team = g_Players[i].team;
const team = g_Players[i].state == "active" ? g_Players[i].team : -1;
this.displayedPlayerColors[i] = g_Players[teamRepresentatives[team] || i].color;
if (team != -1 && !teamRepresentatives[team])
teamRepresentatives[team] = i;