mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 18:58:05 +00:00
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 from 6b52d16faedaf6499f4777ed8156b1eaa09ab554. (cherry-picked from commit ccce10511a2e74e23448e54e652874711bf6bad8)
This commit is contained in:
parent
65092a4cfb
commit
6ae7c8e6c2
@ -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…
x
Reference in New Issue
Block a user