Skip to content

Commit

Permalink
Fix switching among buildmenu and gridmenu. (#3961)
Browse files Browse the repository at this point in the history
* Fix switching among buildmenu and gridmenu.

* Comment so hopefully this won't happen again.

* Fix typo in comment.
  • Loading branch information
saurtron authored Nov 27, 2024
1 parent 1f33e01 commit e145fb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion luaui/Widgets/gui_buildmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,9 @@ end

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

units.checkGeothermalFeatures()
Expand Down
10 changes: 6 additions & 4 deletions luaui/Widgets/gui_gridmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,12 @@ local function cycleBuilder()
end

function widget:Initialize()
if widgetHandler:IsWidgetKnown("Build menu") then
-- Build menu needs to be disabled right now and before we recreate
-- WG['buildmenu'] since its Shutdown will destroy it.
widgetHandler:DisableWidgetRaw("Build menu")
end

myTeamID = Spring.GetMyTeamID()
isSpec = Spring.GetSpectatingState()
isPregame = Spring.GetGameFrame() == 0 and not isSpec
Expand All @@ -1248,10 +1254,6 @@ function widget:Initialize()

doUpdateClock = os.clock()

if widgetHandler:IsWidgetKnown("Build menu") then
widgetHandler:DisableWidget("Build menu")
end

units.checkGeothermalFeatures()

widgetHandler.actionHandler:AddAction(self, "gridmenu_key", gridmenuKeyHandler, nil, "pR")
Expand Down

0 comments on commit e145fb1

Please sign in to comment.