Skip to content

Commit adb224e

Browse files
committed
Remove redundant arguments, add breaks to for loops
1 parent 8af27e4 commit adb224e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fix/codex-pages.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ local function GetPageCount(targetWcType)
6464
['BiographicalDictionary'] = {
6565
upperCount = math.max(300, math.min(500, math.ceil(df.global.hist_figure_next_id / 1000))),
6666
lowerCount = math.max(100, math.min(150, math.floor(df.global.hist_figure_next_id / 10000))),
67-
mode = nil},
67+
mode = nil}, -- Very few samples were available, so this one is mostly arbitrary.
6868
['Genealogy'] = {upperCount = 5, lowerCount = 1, mode = 4},
6969
['Encyclopedia'] = {upperCount = 150, lowerCount = 50, mode = nil},
7070
['CulturalHistory'] = {upperCount = 450, lowerCount = 100, mode = 200},
@@ -121,12 +121,14 @@ local function GetPageCountModifier(targetStyle, targetStrength)
121121
for style, modifier in pairs(styles) do
122122
if df.written_content_style[style] == targetStyle then
123123
pageCountModifier = modifier
124+
break
124125
end
125126
end
126127
for strength, addModifier in pairs(strength) do
127128
if df.writing_style_modifier_type[strength] == targetStrength then
128129
if pageCountModifier ~= 0 then
129130
pageCountModifier = pageCountModifier * addModifier
131+
break
130132
end
131133
end
132134
end
@@ -136,7 +138,7 @@ end
136138
local rng = dfhack.random.new(nil, 10)
137139
local seed = dfhack.world.ReadCurrentTick()
138140

139-
local function SetPageCount(upperCount, lowerCount, mode, seed)
141+
local function SetPageCount(upperCount, lowerCount, mode)
140142
if upperCount > 1 then
141143
local range = upperCount - lowerCount
142144
local increment = 1 + math.floor(range ^ 2)
@@ -184,7 +186,7 @@ local function AddPages(wc)
184186
end
185187
mode = mode or math.ceil((lowerCount + upperCount) / 2)
186188
wc.page_start = 1
187-
wc.page_end = SetPageCount(upperCount, lowerCount, mode, seed)
189+
wc.page_end = SetPageCount(upperCount, lowerCount, mode)
188190
pages = wc.page_end
189191
end
190192
return pages

0 commit comments

Comments
 (0)