gui2/unit_create: Use unit type ids as filtering criteria as well

(cherry-picked from commit 444d6d63f6)
This commit is contained in:
Iris Morelle 2018-09-04 16:45:36 -03:00
parent fc6d71b023
commit fa7ccab4c0
2 changed files with 7 additions and 2 deletions

View file

@ -78,7 +78,8 @@
* Fixed the debug mode Create Unit dialog crashing when changing the gender
of the previous selection after causing the list to come up empty using
the filter box.
* Allow searching by race with the Create Unit filter box as well.
* Allow searching by race and internal unit type id with the Create Unit
filter box as well.
## Version 1.14.4
### Security Fixes

View file

@ -242,11 +242,15 @@ void unit_create::filter_text_changed(text_box_base* textbox, const std::string&
label& race_label
= find_widget<label>(*it, "race", false);
assert(i < units_.size());
const std::string& unit_type_id = units_[i] ? units_[i]->id() : "";
bool found = false;
for(const auto & word : words)
{
found = ci_search(type_label.get_label().str(), word) ||
ci_search(race_label.get_label().str(), word);
ci_search(race_label.get_label().str(), word) ||
ci_search(unit_type_id, word);
if(!found) {
// one word doesn't match, we don't reach words.end()