Ignore vermin in animals screen search

develop
Anuradha Dissanayake 2013-01-06 18:14:25 +13:00 committed by Alexander Gavrilov
parent 8741983aaa
commit 4257c9fe84
1 changed files with 13 additions and 0 deletions

@ -291,6 +291,11 @@ protected:
} }
virtual bool is_valid_for_search(size_t index)
{
return true;
}
// The actual sort // The actual sort
virtual void do_search() virtual void do_search()
{ {
@ -311,6 +316,9 @@ protected:
string search_string_l = toLower(search_string); string search_string_l = toLower(search_string);
for (size_t i = 0; i < saved_list1.size(); i++ ) for (size_t i = 0; i < saved_list1.size(); i++ )
{ {
if (!is_valid_for_search(i))
continue;
T element = saved_list1[i]; T element = saved_list1[i];
string desc = toLower(get_element_description(element)); string desc = toLower(get_element_description(element));
if (desc.find(search_string_l) != string::npos) if (desc.find(search_string_l) != string::npos)
@ -697,6 +705,11 @@ private:
return viewscreen->mode == T_mode::List; return viewscreen->mode == T_mode::List;
} }
bool is_valid_for_search(size_t i)
{
return is_vermin_s[i] == 0;
}
void save_secondary_values() void save_secondary_values()
{ {
is_vermin_s = *is_vermin; is_vermin_s = *is_vermin;