Show correct trade info for observers

Reviewed By: Freagarach
Discussed with and code proposal taken from: elexis
Differential Revision: D3014
This was SVN commit r24071.
This commit is contained in:
bb committed 2020-09-25 21:34:24 +00:00
1 parent adca4ba1f4
commit fbc570674f
1 file changed
+6 -2
@@ -8,8 +8,8 @@ class TradeButtonManager
if (!TradeButtonManager.IsAvailable())
throw "TradeButtonManager instantiated with no tradeable resources or too few buttons!";
// Assume that the simulation state will always follow the GUI
this.tradingGoods = Engine.GuiInterfaceCall("GetTradingGoods", g_ViewedPlayer);
// For players assume that the simulation state will always follow the GUI of this player.
this.tradingGoods = Engine.GuiInterfaceCall("GetTradingGoods");
let resourceCodes = g_ResourceData.GetTradableCodes();
this.selectedResource = resourceCodes[0];
@@ -23,6 +23,10 @@ class TradeButtonManager
update()
{
// Observers can change perspective and values can update while viewing the dialog.
if (g_IsObserver)
this.tradingGoods = Engine.GuiInterfaceCall("GetTradingGoods");
this.tradeHelp.tooltip = colorizeHotkey(translate(this.TradeSwapTooltip), "session.fulltradeswap");
let enabled = controlsPlayer(g_ViewedPlayer);