Skip to content

Commit 6198a9b

Browse files
committed
Fix midgame cable autodetect.
1 parent 372175d commit 6198a9b

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

LuaUI/Widgets/gfx_overdrive_cables_menu.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ local function readCurrentGhosts()
4040
return (Spring.GetConfigInt(GHOSTS_KEY, 1) or 1) ~= 0
4141
end
4242

43+
local function SendDetail()
44+
local detail = options.cabletree_detail.value
45+
if detail == "auto" then
46+
if Platform.gpuVendor == "ATI" and Platform.osFamily == "Linux" then
47+
detail = "off"
48+
else
49+
detail = "full"
50+
end
51+
end
52+
Spring.SendCommands("luarules cabletree detail " .. detail)
53+
end
54+
4355
options_path = 'Settings/Graphics/Energy Grid Cables'
4456
options_order = { 'cabletree_detail', 'cabletree_ghosts' }
4557

@@ -54,9 +66,7 @@ options = {
5466
{ key = 'off', name = 'Off (no cables)', desc = 'Hide the cables/wires entirely.' },
5567
},
5668
value = 'auto',
57-
OnChange = function(self)
58-
Spring.SendCommands("luarules cabletree detail " .. self.value)
59-
end,
69+
OnChange = SendDetail,
6070
},
6171
cabletree_ghosts = {
6272
name = 'Show cable ghosts in fog',
@@ -78,14 +88,5 @@ function widget:Initialize()
7888
options.cabletree_ghosts.value = readCurrentGhosts()
7989
-- And ensure the gadget agrees with whatever was saved (idempotent —
8090
-- the gadget's setters return early if state is unchanged).
81-
local detail = options.cabletree_detail.value
82-
if detail == "auto" then
83-
if Platform.gpuVendor == "ATI" and Platform.osFamily == "Linux" then
84-
detail = "off"
85-
else
86-
detail = "full"
87-
end
88-
end
89-
Spring.SendCommands("luarules cabletree detail " .. detail)
9091
Spring.SendCommands("luarules cabletree ghosts " .. (options.cabletree_ghosts.value and "on" or "off"))
9192
end

0 commit comments

Comments
 (0)