From fbc570674f38e3b718f65e506bed106b3d5a1649 Mon Sep 17 00:00:00 2001 From: bb Date: Fri, 25 Sep 2020 21:34:24 +0000 Subject: [PATCH] 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. --- .../mods/public/gui/session/trade/TradeButtonManager.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/gui/session/trade/TradeButtonManager.js b/binaries/data/mods/public/gui/session/trade/TradeButtonManager.js index 8cfdc681ac..93aafe5124 100644 --- a/binaries/data/mods/public/gui/session/trade/TradeButtonManager.js +++ b/binaries/data/mods/public/gui/session/trade/TradeButtonManager.js @@ -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);