Skip to content

Commit eb772d3

Browse files
authored
Merge pull request #1566 from Halavus/patch-1
ignore language_name_component NONE element with value -1
2 parents af349d9 + 0830ef0 commit eb772d3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Template for new versions:
3131
## New Features
3232

3333
## Fixes
34+
- `gui/rename`: skip ``NONE`` when iterating through language name options
3435
- `quickfort`: work orders will no longer be created with a repetition frequency of ``NONE``
3536

3637
## Misc Improvements

gui/rename.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ function Rename:get_component_choices()
605605
},
606606
data={val=df.language_name_component.TheX, is_first_name=true}})
607607
for val, comp in ipairs(df.language_name_component) do
608+
if val < 0 then goto continue end -- ignore language_name_component NONE element with value -1
608609
local text = {
609610
{text=comp:gsub('(%l)(%u)', '%1 %2')}, NEWLINE,
610611
{gap=2, pen=COLOR_YELLOW, text=function()
@@ -614,6 +615,8 @@ function Rename:get_component_choices()
614615
end},
615616
}
616617
table.insert(choices, {text=text, data={val=val}})
618+
619+
::continue::
617620
end
618621
return choices
619622
end
@@ -632,7 +635,8 @@ function Rename:get_component_action_choices()
632635
table.insert(choices, {text='', data={fn=function() end}})
633636

634637
local randomize_text = {{text='[', pen=COLOR_RED}, 'Random', {text=']', pen=COLOR_RED}}
635-
for comp in ipairs(df.language_name_component) do
638+
for val, comp in ipairs(df.language_name_component) do
639+
if val < 0 then goto continue end -- ignore language_name_component NONE element with value -1
636640
local randomize_fn = self:callback('randomize_component_word', comp)
637641
table.insert(choices, {text=randomize_text, data={fn=randomize_fn}})
638642
local clear_text = {
@@ -643,6 +647,8 @@ function Rename:get_component_action_choices()
643647
local clear_fn = self:callback('clear_component_word', comp)
644648
table.insert(choices, {text=clear_text, data={fn=clear_fn}})
645649
table.insert(choices, {text='', data={fn=function() end}})
650+
651+
::continue::
646652
end
647653
return choices
648654
end

0 commit comments

Comments
 (0)