Skip to content

Commit

Permalink
gui2/campaign_selection: Consider untranslated search terms
Browse files Browse the repository at this point in the history
As I said in 739e260, 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.
  • Loading branch information
irydacea committed Nov 12, 2019
1 parent 15b2995 commit 6e0b39f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/gui/dialogs/campaign_selection.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 6e0b39f

Please sign in to comment.