gui/unit_recall: Add alignment and race hints for filtering
This adds the human-readable version of each unit's alignment and their (gendered) race name and plural race name as hints for the filter box functionality, so that players can enter keywords such as "liminal", "dwarves", "mermaid" and get what they expect even if those words are not literally part of the unit type names.
This commit is contained in:
parent
a924018a84
commit
9f5e61b803
1 changed files with 6 additions and 1 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "team.hpp"
|
||||
#include "units/unit.hpp"
|
||||
#include "units/ptr.hpp"
|
||||
#include "units/types.hpp"
|
||||
#include <functional>
|
||||
#include "whiteboard/manager.hpp"
|
||||
|
||||
|
@ -257,7 +258,11 @@ void unit_recall::pre_show(window& window)
|
|||
|
||||
// Since the table widgets use heavy formatting, we save a bare copy
|
||||
// of certain options to filter on.
|
||||
std::string filter_text = unit->type_name() + " " + name + " " + std::to_string(unit->level());
|
||||
std::string filter_text = unit->type_name() + " " + name + " " + std::to_string(unit->level())
|
||||
+ " " + unit_type::alignment_description(unit->alignment(), unit->gender());
|
||||
if(const auto* race = unit->race()) {
|
||||
filter_text += " " + race->name(unit->gender()) + " " + race->plural_name();
|
||||
}
|
||||
|
||||
if(recallable) {
|
||||
// This is to allow filtering for recallable units by typing "vvv" in the search box.
|
||||
|
|
Loading…
Add table
Reference in a new issue