Unit Create: fixed unit selection not persisting between uses (fixes #2822)
I had been unconditionally selecting the first entry after setting the active sorting option. This overrode the previous unit selection. Regression from6b52d16fae
. (cherry-picked from commitccce10511a
)
This commit is contained in:
parent
65092a4cfb
commit
6ae7c8e6c2
2 changed files with 4 additions and 2 deletions
|
@ -64,6 +64,7 @@
|
|||
* Fixed regression where unit filters in [disable] weapon specials would not
|
||||
match the attacking unit.
|
||||
* Fixed images with no alpha channel rendering incorrectly.
|
||||
* Fixed unit selection not persisting between uses of Create Unit.
|
||||
|
||||
## Version 1.13.12
|
||||
### Security fixes
|
||||
|
|
|
@ -138,7 +138,7 @@ void unit_create::pre_show(window& window)
|
|||
list.add_row(row_data);
|
||||
|
||||
// Select the previous choice, if any.
|
||||
if(choice_.empty() != true && choice_ == i.first) {
|
||||
if(!choice_.empty() && choice_ == i.first) {
|
||||
list.select_last_row();
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,8 @@ void unit_create::pre_show(window& window)
|
|||
list.register_translatable_sorting_option(0, [this](const int i) { return (*units_[i]).race()->plural_name().str(); });
|
||||
list.register_translatable_sorting_option(1, [this](const int i) { return (*units_[i]).type_name().str(); });
|
||||
|
||||
list.set_active_sorting_option({0, listbox::SORT_ASCENDING}, true);
|
||||
// Select the first entry on sort if no previous selection was provided.
|
||||
list.set_active_sorting_option({0, listbox::SORT_ASCENDING}, choice_.empty());
|
||||
|
||||
list_item_clicked(window);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue