From 6a4d2d80a79b98b921a85b5aa71051c288b9301c Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sun, 3 Nov 2024 18:05:28 +1100 Subject: [PATCH 1/5] Remove unused local variables --- luaui/configs/unit_buildmenu_config.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/luaui/configs/unit_buildmenu_config.lua b/luaui/configs/unit_buildmenu_config.lua index b6359304c39..86b2577483c 100644 --- a/luaui/configs/unit_buildmenu_config.lua +++ b/luaui/configs/unit_buildmenu_config.lua @@ -147,12 +147,6 @@ table.sort(unitOrder, function(aID, bID) return aOrder < bOrder end) -local voidWater = false -local success, mapinfo = pcall(VFS.Include,"mapinfo.lua") -- load mapinfo.lua confs -if success and mapinfo then - voidWater = mapinfo.voidwater -end - local minWaterUnitDepth = -11 From 3e064288e5ade2e83a6c4709f68cca574765a9a6 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sun, 3 Nov 2024 18:14:45 +1100 Subject: [PATCH 2/5] Remove unused showWaterUnits boolean --- luaui/configs/unit_buildmenu_config.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/luaui/configs/unit_buildmenu_config.lua b/luaui/configs/unit_buildmenu_config.lua index 86b2577483c..1b2aa6525a9 100644 --- a/luaui/configs/unit_buildmenu_config.lua +++ b/luaui/configs/unit_buildmenu_config.lua @@ -18,8 +18,6 @@ local isWaterUnit = {} local isGeothermal = {} local unitMaxWeaponRange = {} -local showWaterUnits = false - for unitDefID, unitDef in pairs(UnitDefs) do unitGroup[unitDefID] = unitDef.customParams.unitgroup @@ -173,8 +171,6 @@ return { minWaterUnitDepth = minWaterUnitDepth, unitOrder = unitOrder, - showWaterUnits = showWaterUnits, - checkGeothermalFeatures = checkGeothermalFeatures, restrictGeothermalUnits = restrictGeothermalUnits, restrictWindUnits = restrictWindUnits, From 4d924cf0f3d73a4cffb4c195c639337b86d78f8d Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Sun, 3 Nov 2024 18:15:07 +1100 Subject: [PATCH 3/5] Whitespace --- luaui/configs/unit_buildmenu_config.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/luaui/configs/unit_buildmenu_config.lua b/luaui/configs/unit_buildmenu_config.lua index 1b2aa6525a9..f4484169a0e 100644 --- a/luaui/configs/unit_buildmenu_config.lua +++ b/luaui/configs/unit_buildmenu_config.lua @@ -136,14 +136,14 @@ maxOrder = maxOrder + 1 -- For units who have the same order value we compare the unit's IDs. -- This sort is always stable, as no two units should have the same ID. table.sort(unitOrder, function(aID, bID) - local aOrder = unitOrderManualOverrideTable[aID] or maxOrder - local bOrder = unitOrderManualOverrideTable[bID] or maxOrder + local aOrder = unitOrderManualOverrideTable[aID] or maxOrder + local bOrder = unitOrderManualOverrideTable[bID] or maxOrder - if (aOrder == bOrder) then - return aID < bID - end - return aOrder < bOrder - end) + if (aOrder == bOrder) then + return aID < bID + end + return aOrder < bOrder +end) local minWaterUnitDepth = -11 @@ -153,7 +153,6 @@ local minWaterUnitDepth = -11 ------------------------------------ return { - unitName = unitName, unitEnergyCost = unitEnergyCost, unitMetalCost = unitMetalCost, From 173cece1b6f3a55aed697c86b02dbc67c37bdd10 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Fri, 8 Nov 2024 20:58:07 +1100 Subject: [PATCH 4/5] Remove unused unitName Table was not initialized nor referenced --- luaui/configs/unit_buildmenu_config.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/luaui/configs/unit_buildmenu_config.lua b/luaui/configs/unit_buildmenu_config.lua index f4484169a0e..c4a7b76504e 100644 --- a/luaui/configs/unit_buildmenu_config.lua +++ b/luaui/configs/unit_buildmenu_config.lua @@ -4,7 +4,6 @@ --- -local unitName = {} local unitEnergyCost = {} local unitMetalCost = {} local unitGroup = {} @@ -153,7 +152,6 @@ local minWaterUnitDepth = -11 ------------------------------------ return { - unitName = unitName, unitEnergyCost = unitEnergyCost, unitMetalCost = unitMetalCost, unitGroup = unitGroup, From 4801b4c92d74047d2cba2b116e5df022b6a28fc5 Mon Sep 17 00:00:00 2001 From: Rhys van der Waerden Date: Fri, 15 Nov 2024 10:08:25 +1100 Subject: [PATCH 5/5] Remove unnecessary assignment Doesn't seem to be serving a purpose and complicates type annotations (to be added in a later commit) --- luaui/configs/buildmenu_sorting.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/luaui/configs/buildmenu_sorting.lua b/luaui/configs/buildmenu_sorting.lua index d076550de64..23c6f705ef3 100644 --- a/luaui/configs/buildmenu_sorting.lua +++ b/luaui/configs/buildmenu_sorting.lua @@ -776,7 +776,6 @@ for id, value in pairs(unitOrderTable) do end end unitOrderTable = newUnitOrder -newUnitOrder = nil for unitDefID, unitDef in pairs(UnitDefs) do if unitDef.customParams.isscavenger then