Index: binaries/data/mods/public/gui/session/messages.js
===================================================================
--- binaries/data/mods/public/gui/session/messages.js
+++ binaries/data/mods/public/gui/session/messages.js
@@ -338,10 +338,12 @@
"status": notification.status
});
updatePlayerData();
+ updateDisplayedPlayerColors();
},
"ceasefire-ended": function(notification, player)
{
updatePlayerData();
+ updateDisplayedPlayerColors();
},
"tutorial": function(notification, player)
{
Index: binaries/data/mods/public/gui/session/minimap_panel.xml
===================================================================
--- binaries/data/mods/public/gui/session/minimap_panel.xml
+++ binaries/data/mods/public/gui/session/minimap_panel.xml
@@ -21,11 +21,28 @@
name="idleWorkerButton"
type="button"
size="100%-120 100%-120 100%-5 100%-5"
- tooltip_style="sessionToolTip" hotkey="selection.idleworker"
+ tooltip_style="sessionToolTip"
+ hotkey="selection.idleworker"
sprite="stretched:session/minimap-idle.png"
sprite_over="stretched:session/minimap-idle-highlight.png"
sprite_disabled="stretched:session/minimap-idle-disabled.png"
>
findIdleUnit(g_WorkerTypes);
+
+
+
Index: binaries/data/mods/public/gui/session/session.js
===================================================================
--- binaries/data/mods/public/gui/session/session.js
+++ binaries/data/mods/public/gui/session/session.js
@@ -12,6 +12,13 @@
var g_GameSpeeds;
/**
+ * Diplomacy colors (ally/neutral/enemy as a player, teams as an observer).
+ */
+var g_OriginalColors;
+var g_DiplomacyColorPalette;
+var g_DiplomacyColorsToggle = false;
+
+/**
* Colors to flash when pop limit reached.
*/
var g_DefaultPopulationColor = "white";
@@ -278,7 +285,8 @@
LoadModificationTemplates();
updatePlayerData();
- Engine.GuiInterfaceCall("UpdateDisplayedPlayerColors");
+ g_OriginalColors = g_Players.map(x => x.color);
+ g_DiplomacyColorPalette = Engine.ReadJSONFile(g_SettingsDirectory + "diplomacy_colors.json");
g_BarterSell = g_ResourceData.GetCodes()[0];
@@ -304,6 +312,8 @@
initChatWindow();
+ updateDisplayedPlayerColors();
+
sendLobbyPlayerlistUpdate();
onSimulationUpdate();
setTimeout(displayGamestateNotifications, 1000);
@@ -367,6 +377,47 @@
g_Players = playerData;
}
+/*
+ * Updates the displayed colors of players in the simulation and GUI.
+ */
+function updateDisplayedPlayerColors()
+{
+ if (g_DiplomacyColorsToggle)
+ {
+ let teamColors = {};
+ for (let i = 1; i < g_Players.length; ++i)
+ if (g_ViewedPlayer <= 0)
+ {
+ // Observers (and gaia) see team colors
+ let team = g_Players[i].team;
+ g_Players[i].color = g_OriginalColors[teamColors[team] || i];
+ if (team != -1 && !teamColors[team])
+ teamColors[team] = i;
+ }
+ else
+ // Otherwise the color depends on diplomacy
+ g_Players[i].color =
+ g_ViewedPlayer == i ? g_DiplomacyColorPalette.Self :
+ g_Players[g_ViewedPlayer].isAlly[i] ? g_DiplomacyColorPalette.Ally :
+ g_Players[g_ViewedPlayer].isNeutral[i] ? g_DiplomacyColorPalette.Neutral :
+ g_DiplomacyColorPalette.Enemy;
+
+ Engine.GuiInterfaceCall("SetDiplomacyColors", g_Players.map(player => player.color));
+ }
+ else
+ for (let i = 1; i < g_Players.length; ++i)
+ g_Players[i].color = g_OriginalColors[i];
+
+ Engine.GuiInterfaceCall("UpdateDisplayedPlayerColors", {
+ "displayDiplomacyColors": g_DiplomacyColorsToggle,
+ "showAllStatusBars": g_ShowAllStatusBars,
+ "selected": g_Selection.toList()
+ });
+
+ updateViewedPlayerDropdown();
+ updateGUIObjects();
+}
+
/**
* Depends on the current player (g_IsObserver).
*/
@@ -486,6 +537,7 @@
}
Engine.SetViewedPlayer(g_ViewedPlayer);
+ updateDisplayedPlayerColors();
updateTopPanel();
updateChatAddressees();
updateHotkeyTooltips();
Index: binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/GuiInterface.js
+++ binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -844,16 +844,70 @@
};
/**
- * Updates player colors on the minimap.
+ * Sets the diplomacy color of every player (excluding gaia).
*/
-GuiInterface.prototype.UpdateDisplayedPlayerColors = function()
+GuiInterface.prototype.SetDiplomacyColors = function(player, data)
{
- for (let ent of Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetGaiaAndNonGaiaEntities())
+ for (let i = 1; i < data.length; ++i)
{
- let cmpMinimap = Engine.QueryInterface(ent, IID_Minimap);
- if (cmpMinimap)
- cmpMinimap.UpdateColor();
+ let cmpPlayer = QueryPlayerIDInterface(i, IID_Player);
+ if (!cmpPlayer)
+ continue;
+
+ cmpPlayer.SetDiplomacyColor(data[i].r, data[i].g, data[i].b);
+ }
+};
+
+/**
+ * Updates the player color in various components.
+ */
+GuiInterface.prototype.UpdateDisplayedPlayerColors = function(player, data)
+{
+ let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
+ let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
+ for (let i = 1; i < numPlayers; ++i)
+ {
+ let cmpPlayer = QueryPlayerIDInterface(i, IID_Player);
+ if (!cmpPlayer)
+ continue;
+
+ cmpPlayer.SetDisplayDiplomacyColor(data.displayDiplomacyColors);
+
+ for (let ent of cmpRangeManager.GetEntitiesByPlayer(i))
+ {
+ let cmpMinimap = Engine.QueryInterface(ent, IID_Minimap);
+ if (cmpMinimap)
+ cmpMinimap.UpdateColor();
+
+ let cmpRangeOverlayRenderer = Engine.QueryInterface(ent, IID_RangeOverlayRenderer);
+ if (cmpRangeOverlayRenderer)
+ cmpRangeOverlayRenderer.UpdateColor();
+
+ let cmpRallyPointRenderer = Engine.QueryInterface(ent, IID_RallyPointRenderer);
+ if (cmpRallyPointRenderer)
+ cmpRallyPointRenderer.UpdateColor();
+
+ if (data.showAllStatusBars && (i == player || player == -1))
+ {
+ let cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars);
+ if (cmpStatusBars)
+ cmpStatusBars.RegenerateSprites();
+ }
+ }
}
+
+ for (let ent of data.selected)
+ {
+ let cmpSelectable = Engine.QueryInterface(ent, IID_Selectable);
+ if (cmpSelectable)
+ cmpSelectable.UpdateColor();
+
+ let cmpStatusBars = Engine.QueryInterface(ent, IID_StatusBars);
+ if (cmpStatusBars)
+ cmpStatusBars.RegenerateSprites();
+ }
+
+ Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors();
};
GuiInterface.prototype.SetSelectionHighlight = function(player, cmd)
@@ -1991,6 +2045,7 @@
"GetFormationInfoFromTemplate": 1,
"IsStanceSelected": 1,
+ "SetDiplomacyColors": 1,
"UpdateDisplayedPlayerColors": 1,
"SetSelectionHighlight": 1,
"GetAllBuildableEntities": 1,
Index: binaries/data/mods/public/simulation/components/Player.js
===================================================================
--- binaries/data/mods/public/simulation/components/Player.js
+++ binaries/data/mods/public/simulation/components/Player.js
@@ -22,6 +22,19 @@
"";
/**
+ * Don't serialize diplomacyColor or displayDiplomacyColor since they're modified by the GUI.
+ */
+Player.prototype.Serialize = function()
+{
+ let state = {};
+ for (let key in this)
+ if (this.hasOwnProperty(key) && key != "diplomacyColor" && key != "displayDiplomacyColor")
+ state[key] = this[key];
+
+ return state;
+};
+
+/**
* Which units will be shown with special icons at the top.
*/
var panelEntityClasses = "Hero Relic";
@@ -31,7 +44,9 @@
this.playerID = undefined;
this.name = undefined; // define defaults elsewhere (supporting other languages)
this.civ = undefined;
- this.color = undefined;
+ this.originalColor = undefined;
+ this.diplomacyColor = undefined;
+ this.displayDiplomacyColor = false;
this.popUsed = 0; // population of units owned or trained by this player
this.popBonuses = 0; // sum of population bonuses of player's entities
this.maxPop = 300; // maximum population
@@ -118,11 +133,11 @@
return this.civ;
};
-Player.prototype.SetColor = function(r, g, b)
+Player.prototype.SetOriginalColor = function(r, g, b)
{
- var colorInitialized = !!this.color;
+ var colorInitialized = !!this.originalColor;
- this.color = { "r": r/255.0, "g": g/255.0, "b": b/255.0, "a": 1.0 };
+ this.originalColor = { "r": r / 255, "g": g / 255, "b": b / 255, "a": 1 };
// Used in Atlas
if (colorInitialized)
@@ -131,9 +146,22 @@
});
};
+Player.prototype.SetDiplomacyColor = function(r, g, b)
+{
+ this.diplomacyColor = { "r": r / 255, "g": g / 255, "b": b / 255, "a": 1 };
+};
+
+Player.prototype.SetDisplayDiplomacyColor = function(displayDiplomacyColor)
+{
+ this.displayDiplomacyColor = displayDiplomacyColor;
+};
+
+/*
+ * Get the player color that's used in various components.
+ */
Player.prototype.GetColor = function()
{
- return this.color;
+ return this.displayDiplomacyColor ? this.diplomacyColor : this.originalColor;
};
// Try reserving num population slots. Returns 0 on success or number of missing slots otherwise.
Index: binaries/data/mods/public/simulation/data/settings/diplomacy_colors.json
===================================================================
--- /dev/null
+++ binaries/data/mods/public/simulation/data/settings/diplomacy_colors.json
@@ -0,0 +1,6 @@
+{
+ "Self": { "r": 21, "g": 55, "b": 149 },
+ "Ally": { "r": 86, "g": 180, "b": 31 },
+ "Neutral": { "r": 231, "g": 200, "b": 5 },
+ "Enemy": { "r": 150, "g": 20, "b": 20 }
+}
Index: binaries/data/mods/public/simulation/helpers/Player.js
===================================================================
--- binaries/data/mods/public/simulation/helpers/Player.js
+++ binaries/data/mods/public/simulation/helpers/Player.js
@@ -74,7 +74,7 @@
cmpPlayer.SetCiv(getSetting(playerData, playerDefaults, i, "Civ"));
var color = getSetting(playerData, playerDefaults, i, "Color");
- cmpPlayer.SetColor(color.r, color.g, color.b);
+ cmpPlayer.SetOriginalColor(color.r, color.g, color.b);
// Special case for gaia
if (i == 0)
Index: source/simulation2/components/CCmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/CCmpRallyPointRenderer.cpp
+++ source/simulation2/components/CCmpRallyPointRenderer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -351,6 +351,16 @@
return !m_RallyPoints.empty();
}
+ void UpdateColor()
+ {
+ UpdateLineColor();
+
+ for (std::vector& texturedOverlayLine : m_TexturedOverlayLines)
+ for (SOverlayTexturedLine& segment : texturedOverlayLine)
+ if (segment.m_Color != m_LineDashColor)
+ segment.m_Color = m_LineColor;
+ }
+
private:
/**
Index: source/simulation2/components/CCmpRangeOverlayRenderer.cpp
===================================================================
--- source/simulation2/components/CCmpRangeOverlayRenderer.cpp
+++ source/simulation2/components/CCmpRangeOverlayRenderer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -23,6 +23,7 @@
#include "graphics/TextureManager.h"
#include "renderer/Renderer.h"
#include "simulation2/MessageTypes.h"
+#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPlayer.h"
#include "simulation2/components/ICmpPlayerManager.h"
#include "simulation2/components/ICmpPosition.h"
@@ -121,20 +122,7 @@
}
case MT_OwnershipChanged:
{
- const CMessageOwnershipChanged& msgData = static_cast (msg);
- if (msgData.to == INVALID_PLAYER)
- break;
-
- CmpPtr cmpPlayerManager(GetSystemEntity());
- if (!cmpPlayerManager)
- break;
-
- CmpPtr cmpPlayer(GetSimContext(), cmpPlayerManager->GetPlayerByID(msgData.to));
- if (!cmpPlayer)
- break;
-
- CColor color = cmpPlayer->GetColor();
- m_Color = color;
+ UpdateColor();
break;
}
case MT_RenderSubmit:
@@ -146,6 +134,28 @@
}
}
+ virtual void UpdateColor()
+ {
+ CmpPtr cmpOwnership(GetEntityHandle());
+ if (!cmpOwnership)
+ return;
+
+ player_id_t owner = cmpOwnership->GetOwner();
+ if (owner == INVALID_PLAYER)
+ return;
+
+ CmpPtr cmpPlayerManager(GetSystemEntity());
+ if (!cmpPlayerManager)
+ return;
+
+ CmpPtr cmpPlayer(GetSimContext(), cmpPlayerManager->GetPlayerByID(owner));
+ if (!cmpPlayer)
+ return;
+
+ CColor color = cmpPlayer->GetColor();
+ m_Color = color;
+ }
+
void UpdateMessageSubscriptions()
{
bool needInterpolate = false;
Index: source/simulation2/components/CCmpSelectable.cpp
===================================================================
--- source/simulation2/components/CCmpSelectable.cpp
+++ source/simulation2/components/CCmpSelectable.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -244,7 +244,7 @@
/**
* Set the color of the current owner.
*/
- void UpdatePlayerColor();
+ virtual void UpdateColor();
private:
SOverlayDescriptor m_OverlayDescriptor;
@@ -333,7 +333,7 @@
if (msgData.from == INVALID_PLAYER || msgData.to == INVALID_PLAYER)
break;
- UpdatePlayerColor();
+ UpdateColor();
InvalidateStaticOverlay();
break;
}
@@ -345,7 +345,7 @@
if (!cmpOwnership || msgData.player != cmpOwnership->GetOwner())
break;
- UpdatePlayerColor();
+ UpdateColor();
break;
}
case MT_PositionChanged:
@@ -378,7 +378,7 @@
}
}
-void CCmpSelectable::UpdatePlayerColor()
+void CCmpSelectable::UpdateColor()
{
CmpPtr cmpOwnership(GetEntityHandle());
@@ -556,7 +556,7 @@
{
if (!m_Cached)
{
- UpdatePlayerColor();
+ UpdateColor();
m_Cached = true;
}
Index: source/simulation2/components/CCmpTerritoryManager.cpp
===================================================================
--- source/simulation2/components/CCmpTerritoryManager.cpp
+++ source/simulation2/components/CCmpTerritoryManager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -102,6 +102,7 @@
struct SBoundaryLine
{
bool blinking;
+ player_id_t owner;
CColor color;
SOverlayTexturedLine overlay;
};
@@ -128,6 +129,7 @@
m_DirtyID = 1;
m_DirtyBlinkingID = 1;
m_Visible = true;
+ m_ColorChanged = false;
m_AnimTime = 0.0;
@@ -258,6 +260,8 @@
size_t m_DirtyID;
size_t m_DirtyBlinkingID;
+ bool m_ColorChanged;
+
void MakeDirty()
{
SAFE_DELETE(m_Territories);
@@ -266,14 +270,12 @@
m_TriggerEvent = true;
}
- virtual bool NeedUpdate(size_t* dirtyID) const
+ virtual bool NeedUpdate(size_t* dirtyID)
{
- if (*dirtyID != m_DirtyID)
- {
- *dirtyID = m_DirtyID;
- return true;
- }
- return false;
+ bool ret = *dirtyID != m_DirtyID || m_ColorChanged;
+ *dirtyID = m_DirtyID;
+ m_ColorChanged = false;
+ return ret;
}
virtual bool NeedUpdate(size_t* dirtyID, size_t* dirtyBlinkingID) const
@@ -306,6 +308,8 @@
m_Visible = visible;
}
+ void UpdateColors();
+
private:
bool m_Visible;
@@ -627,6 +631,7 @@
m_BoundaryLines.push_back(SBoundaryLine());
m_BoundaryLines.back().blinking = boundaries[i].blinking;
+ m_BoundaryLines.back().owner = boundaries[i].owner;
m_BoundaryLines.back().color = color;
m_BoundaryLines.back().overlay.m_SimContext = &GetSimContext();
m_BoundaryLines.back().overlay.m_TextureBase = textureBase;
@@ -805,6 +810,22 @@
return (m_Territories->get(i, j) & TERRITORY_BLINKING_MASK) != 0;
}
+void CCmpTerritoryManager::UpdateColors()
+{
+ m_ColorChanged = true;
+
+ CmpPtr cmpPlayerManager(GetSystemEntity());
+ if (!cmpPlayerManager)
+ return;
+
+ for (SBoundaryLine& boundaryLine : m_BoundaryLines)
+ {
+ CmpPtr cmpPlayer(GetSimContext(), cmpPlayerManager->GetPlayerByID(boundaryLine.owner));
+ if (cmpPlayer)
+ boundaryLine.overlay.m_Color = boundaryLine.color = cmpPlayer->GetColor();
+ }
+}
+
TerritoryOverlay::TerritoryOverlay(CCmpTerritoryManager& manager) :
TerrainTextureOverlay((float)Pathfinding::NAVCELLS_PER_TILE / ICmpTerritoryManager::NAVCELLS_PER_TERRITORY_TILE),
m_TerritoryManager(manager)
Index: source/simulation2/components/ICmpRallyPointRenderer.h
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.h
+++ source/simulation2/components/ICmpRallyPointRenderer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -50,6 +50,9 @@
/// Returns true if at least one display rally point is set
virtual bool IsSet() const = 0;
+ /// Updates the line color
+ virtual void UpdateColor() = 0;
+
DECLARE_INTERFACE_TYPE(RallyPointRenderer)
};
Index: source/simulation2/components/ICmpRallyPointRenderer.cpp
===================================================================
--- source/simulation2/components/ICmpRallyPointRenderer.cpp
+++ source/simulation2/components/ICmpRallyPointRenderer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -29,4 +29,5 @@
DEFINE_INTERFACE_METHOD_1("AddPosition", void, ICmpRallyPointRenderer, AddPosition_wrapper, CFixedVector2D)
DEFINE_INTERFACE_METHOD_0("Reset", void, ICmpRallyPointRenderer, Reset)
DEFINE_INTERFACE_METHOD_CONST_0("IsSet", bool, ICmpRallyPointRenderer, IsSet)
+DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpRallyPointRenderer, UpdateColor)
END_INTERFACE_WRAPPER(RallyPointRenderer)
Index: source/simulation2/components/ICmpRangeOverlayRenderer.h
===================================================================
--- source/simulation2/components/ICmpRangeOverlayRenderer.h
+++ source/simulation2/components/ICmpRangeOverlayRenderer.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -34,6 +34,11 @@
*/
virtual void ResetRangeOverlays() = 0;
+ /**
+ * Updates the overlay color to match the player color.
+ */
+ virtual void UpdateColor() = 0;
+
DECLARE_INTERFACE_TYPE(RangeOverlayRenderer)
};
Index: source/simulation2/components/ICmpRangeOverlayRenderer.cpp
===================================================================
--- source/simulation2/components/ICmpRangeOverlayRenderer.cpp
+++ source/simulation2/components/ICmpRangeOverlayRenderer.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -23,4 +23,5 @@
BEGIN_INTERFACE_WRAPPER(RangeOverlayRenderer)
DEFINE_INTERFACE_METHOD_4("AddRangeOverlay", void, ICmpRangeOverlayRenderer, AddRangeOverlay, float, std::string, std::string, float)
DEFINE_INTERFACE_METHOD_0("ResetRangeOverlays", void, ICmpRangeOverlayRenderer, ResetRangeOverlays)
+DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpRangeOverlayRenderer, UpdateColor)
END_INTERFACE_WRAPPER(RangeOverlayRenderer)
Index: source/simulation2/components/ICmpSelectable.h
===================================================================
--- source/simulation2/components/ICmpSelectable.h
+++ source/simulation2/components/ICmpSelectable.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -31,7 +31,7 @@
virtual bool IsEditorOnly() const = 0;
/**
- * Set the selection highlight state.
+ * Sets the selection highlight state.
* The highlight is typically a circle/square overlay around the unit.
* @param color color and alpha of the selection highlight. Set color.a = 0 to hide the highlight.
* @param selected whether the entity is selected; affects desaturation for always visible highlights.
@@ -54,7 +54,12 @@
}
/**
- * Set the alpha of the selection highlight. Set to 0 to hide the highlight.
+ * Updates the selection color to match the current owner.
+ */
+ virtual void UpdateColor() = 0;
+
+ /**
+ * Sets the alpha of the selection highlight. Set to 0 to hide the highlight.
*/
virtual void SetSelectionHighlightAlpha(float alpha) = 0;
Index: source/simulation2/components/ICmpSelectable.cpp
===================================================================
--- source/simulation2/components/ICmpSelectable.cpp
+++ source/simulation2/components/ICmpSelectable.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -25,6 +25,7 @@
BEGIN_INTERFACE_WRAPPER(Selectable)
DEFINE_INTERFACE_METHOD_2("SetSelectionHighlight", void, ICmpSelectable, SetSelectionHighlight, CColor, bool)
+DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpSelectable, UpdateColor)
END_INTERFACE_WRAPPER(Selectable)
bool ICmpSelectable::ms_EnableDebugOverlays = false;
Index: source/simulation2/components/ICmpTerritoryManager.h
===================================================================
--- source/simulation2/components/ICmpTerritoryManager.h
+++ source/simulation2/components/ICmpTerritoryManager.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -29,7 +29,7 @@
class ICmpTerritoryManager : public IComponent
{
public:
- virtual bool NeedUpdate(size_t* dirtyID) const = 0;
+ virtual bool NeedUpdate(size_t* dirtyID) = 0;
virtual bool NeedUpdate(size_t* dirtyID, size_t* dirtyBlinkingID) const = 0;
/**
@@ -91,6 +91,11 @@
*/
virtual void SetVisibility(bool visible) = 0;
+ /**
+ * Updates the boundary and territory colors.
+ */
+ virtual void UpdateColors() = 0;
+
DECLARE_INTERFACE_TYPE(TerritoryManager)
};
Index: source/simulation2/components/ICmpTerritoryManager.cpp
===================================================================
--- source/simulation2/components/ICmpTerritoryManager.cpp
+++ source/simulation2/components/ICmpTerritoryManager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Wildfire Games.
+/* Copyright (C) 2018 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -28,4 +28,5 @@
DEFINE_INTERFACE_METHOD_3("SetTerritoryBlinking", void, ICmpTerritoryManager, SetTerritoryBlinking, entity_pos_t, entity_pos_t, bool)
DEFINE_INTERFACE_METHOD_2("IsTerritoryBlinking", bool, ICmpTerritoryManager, IsTerritoryBlinking, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_1("GetTerritoryPercentage", u8, ICmpTerritoryManager, GetTerritoryPercentage, player_id_t)
+DEFINE_INTERFACE_METHOD_0("UpdateColors", void, ICmpTerritoryManager, UpdateColors)
END_INTERFACE_WRAPPER(TerritoryManager)