Skip to content

Commit

Permalink
buildmenu: Fix caching I18N entries before I18N actually runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwetuin committed Jan 19, 2025
1 parent 7899c7b commit ac58d0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions luaui/Widgets/gui_buildmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ local function refreshUnitDefs()
end
end
end
refreshUnitDefs()

local spIsUnitSelected = Spring.IsUnitSelected
local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount
Expand Down Expand Up @@ -556,7 +555,7 @@ local function drawCell(cellRectID, usedZoom, cellColor, disabled, colls)
)
end


local quotaNumber, builderID
for _, factoryID in ipairs(spGetSelectedUnits()) do
if WG.Quotas and WG.Quotas.getQuotas()[factoryID] and WG.Quotas.getQuotas()[factoryID][uDefID] then
Expand Down Expand Up @@ -1034,7 +1033,7 @@ local function isOnQuotaBuildMode(targetDefID)
for _, unitID in ipairs(spGetSelectedUnits()) do
local uDefID = spGetUnitDefID(unitID)
if units.isFactory[uDefID] and table.contains(unitBuildOptions[uDefID], targetDefID) then
return WG.Quotas and WG.Quotas.isOnQuotaMode(unitID)
return WG.Quotas and WG.Quotas.isOnQuotaMode(unitID)
end
end
return false
Expand Down Expand Up @@ -1245,6 +1244,8 @@ local function bindBuildUnits(widget)
end

function widget:Initialize()
refreshUnitDefs()

if widgetHandler:IsWidgetKnown("Grid menu") then
-- Grid menu needs to be disabled right now and before we recreate
-- WG['buildmenu'] since its Shutdown will destroy it.
Expand Down

0 comments on commit ac58d0b

Please sign in to comment.