gui2/campaign_selection: Consider untranslated search terms

As I said in 739e2608db, the abbreviations
and names of campaigns in English tend to be better known by the
community, so they are also useful to consider when searching through
the list.

The description's untranslated version is also included in this even
though descriptions are longer and a bit more expensive to sift through.
It may still come in handy in cases where proper names get inflected or
transliterated I guess.
This commit is contained in:
Iris Morelle 2019-11-12 16:21:59 -03:00
parent 15b2995c30
commit 6e0b39f329
2 changed files with 5 additions and 2 deletions

View file

@ -32,7 +32,7 @@
* Dunefolk: rebalancing and renaming of various units
### User interface
* The load-game dialog can now see the directories used by Wesnoth 1.14, 1.12, etc.
* The search box in the Campaigns menu now takes campaign abbreviations and descriptions (in the current language)
* The search box in the Campaigns menu now takes campaign abbreviations and descriptions
into account.
### Lua API
* unit:transform() now takes an optional variation parameter

View file

@ -164,8 +164,11 @@ void campaign_selection::sort_campaigns(window& window, campaign_selection::CAMP
bool found = false;
for(const auto& word : last_search_words_) {
found = translation::ci_search(levels[i]->name(), word) ||
translation::ci_search(levels[i]->data()["name"].t_str().base_str(), word) ||
translation::ci_search(levels[i]->description(), word) ||
translation::ci_search(levels[i]->data()["abbrev"], word);
translation::ci_search(levels[i]->data()["description"].t_str().base_str(), word) ||
translation::ci_search(levels[i]->data()["abbrev"], word) ||
translation::ci_search(levels[i]->data()["abbrev"].t_str().base_str(), word);
if(!found) {
break;