Skip to content

Commit

Permalink
Fix for players without the expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
astog committed Jun 1, 2020
1 parent c8b369f commit 2db0c2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions UI/TradeSupport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local BACKDROP_DARKER_OFFSET = -85
local BACKDROP_DARKER_OPACITY = 238
local BACKDROP_BRIGHTER_OFFSET = 90
local BACKDROP_BRIGHTER_OPACITY = 250
local USING_ERA_BASED_TRADE_ROUTE_LENGTH:boolean = GameInfo.Eras_XP2 ~= nil
local USING_ERA_BASED_TRADE_ROUTE_LENGTH:boolean = (GameInfo.Eras_XP2 ~= nil) and (Game.GetEras ~= nil)

-- ===========================================================================
-- Global Constants
Expand Down Expand Up @@ -178,6 +178,11 @@ function UpdateRoutesWithTurnsRemaining( routesTable:table )
end

function IsEraChange()
-- If we don't have R&F expansion (EXP2) just return false
if not USING_ERA_BASED_TRADE_ROUTE_LENGTH then
return false
end

-- Handle detecting era change
local localPlayer :number = Game.GetLocalPlayer();
local currentEra :number = Game.GetEras():GetCurrentEra();
Expand Down Expand Up @@ -1784,7 +1789,9 @@ end
function TradeSupportTracker_Initialize()
print("Initializing BTS Trade Support Tracker");

m_lastEraKnown = Game.GetEras():GetCurrentEra()
if USING_ERA_BASED_TRADE_ROUTE_LENGTH then
m_lastEraKnown = Game.GetEras():GetCurrentEra()
end

-- Load Previous Routes
LoadRunningRoutesInfo();
Expand Down

0 comments on commit 2db0c2a

Please sign in to comment.