Skip to content

Commit 7173b99

Browse files
committed
Fix #4: Centralize missile command IDs to prevent duplication
Define missileCmdIDs table and isMissileCommand() helper at top of integral_menu_config.lua. Replace hardcoded ID lists in both Missiles panel inclusionFunction and Orders panel exclusion with helper calls. Fixes maintenance issue where IDs could get out of sync between panels. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiaPfKSj8kGFjaUPyxYYHd
1 parent da09486 commit 7173b99

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

LuaUI/Configs/integral_menu_config.lua

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
local buildCmdFactory, buildCmdEconomy, buildCmdDefence, buildCmdSpecial, buildCmdUnits, cmdPosDef, factoryUnitPosDef = include("Configs/integral_menu_commands_processed.lua", nil, VFS.RAW_FIRST)
22

3+
local missileCmdIDs = {
4+
39610, -- EOS
5+
39611, -- Seismic
6+
39612, -- Shockley
7+
39613, -- Inferno
8+
39614, -- Reef Missile
9+
39615, -- Trinity
10+
39616, -- Zeno
11+
}
12+
13+
local function isMissileCommand(cmdID)
14+
for _, id in ipairs(missileCmdIDs) do
15+
if cmdID == id then return true end
16+
end
17+
return false
18+
end
19+
320
--------------------------------------------------------------------------------
421
--------------------------------------------------------------------------------
522
-- Tooltips
@@ -516,8 +533,7 @@ local commandPanels = {
516533
name = "missiles",
517534
inclusionFunction = function(cmdID)
518535
if not hasMissileUnits() then return false end
519-
return (cmdID == 39610 or cmdID == 39611 or cmdID == 39612 or
520-
cmdID == 39613 or cmdID == 39614 or cmdID == 39615 or cmdID == 39616)
536+
return isMissileCommand(cmdID)
521537
end,
522538
loiterable = true,
523539
buttonLayoutConfig = buttonLayoutConfig.command,
@@ -534,8 +550,7 @@ local commandPanels = {
534550
not buildCmdEconomy[cmdID] and not buildCmdFactory[cmdID] and
535551
not buildCmdSpecial[cmdID] and not buildCmdDefence[cmdID] and
536552
not plateCommandID[cmdID] and
537-
not (cmdID == 39610 or cmdID == 39611 or cmdID == 39612 or
538-
cmdID == 39613 or cmdID == 39614 or cmdID == 39615 or cmdID == 39616))
553+
not isMissileCommand(cmdID))
539554
end,
540555
loiterable = true,
541556
buttonLayoutConfig = buttonLayoutConfig.command,

0 commit comments

Comments
 (0)