Skip to content

Commit 23ab32e

Browse files
authored
remove unnecessary loop
the for loop inside unitdef_post is not needed, because unitdef_post is called once for every unit. the for loop makes it loop exponentially more times.
1 parent 8986ab7 commit 23ab32e

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

lua/tweakdefs2/raptor hp 1.7X.lua

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
-- docs.google.com/spreadsheets/d/1QSVsuAAMhBrhiZdTihVfSCwPzbbZWDLCtXWP23CU0ko
33

44
local oldUnitDef_Post = UnitDef_Post
5-
function UnitDef_Post(i, j)
5+
function UnitDef_Post(unitID, unitDef)
66
if oldUnitDef_Post and oldUnitDef_Post ~= UnitDef_Post then
7-
oldUnitDef_Post(i, j)
7+
oldUnitDef_Post(unitID, unitDef)
88
end
99

10-
for unitName, unitDef in pairs(UnitDefs) do
11-
if unitDef.customparams and unitDef.customparams.subfolder == 'other/raptors' then
12-
unitDef.metalcost = math.floor(unitDef.metalcost)
13-
unitDef.nochasecategory = "OBJECT"
14-
end
15-
end
10+
if unitDef.customparams and unitDef.customparams.subfolder == 'other/raptors' then
11+
unitDef.metalcost = math.floor(unitDef.metalcost)
12+
unitDef.nochasecategory = "OBJECT"
13+
end
1614
end
1715

1816
for unitName, unitDef in pairs(UnitDefs) do

0 commit comments

Comments
 (0)