Bugfix 22987 - Game filter does not work.

Changed the search filter in the mulitplayer lobby to
search on era and mod as well as title and description.
This commit is contained in:
Randypk 2015-03-20 21:26:06 -06:00 committed by Ignacio R. Morelle
parent ae58d70d03
commit a5b9c89305
2 changed files with 12 additions and 3 deletions

View file

@ -6,6 +6,7 @@ Version 1.12.4+dev:
* Updated translations:
* Multiplayer:
* Era names no longer support formatting markup in the game setup screen.
* Made MP lobby filter option filter on eras and mods too (bug #22987).
* Miscellaneous and bug fixes:
* Default to non-strict compilation with CMake.
* Fixed strict compilation with clang 3.5 and 3.6.

View file

@ -769,8 +769,16 @@ bool gamebrowser::game_matches_filter(const game_item& i, const config& cfg) {
if(!preferences::fi_text().empty()) {
bool found_match = true;
BOOST_FOREACH(const std::string& search_string, utils::split(preferences::fi_text(), ' ', utils::STRIP_SPACES)) {
if(std::search(i.map_info.begin(), i.map_info.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.map_info.end() &&
std::search(i.name.begin(), i.name.end(), search_string.begin(), search_string.end(), chars_equal_insensitive) == i.name.end()) {
if(std::search(i.map_info.begin(), i.map_info.end(), search_string.begin(),
search_string.end(), chars_equal_insensitive) == i.map_info.end()
&&
std::search(i.name.begin(), i.name.end(), search_string.begin(),
search_string.end(), chars_equal_insensitive) == i.name.end()
&&
std::search(i.era_and_mod_info.begin(), i.era_and_mod_info.end(),
search_string.begin(), search_string.end(), chars_equal_insensitive)
== i.era_and_mod_info.end()) {
found_match = false;
break;
}
@ -910,7 +918,7 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
filter_label_.enable(apply_filter_.checked());
filter_text_.set_text(search_string_);
filter_text_.set_help_string(_("Only show games whose title or description contain the entered text"));
filter_text_.set_help_string(_("Only show games whose title, description, era or mods contain the entered text"));
filter_text_.enable(apply_filter_.checked());
gamelist_updated();