* Update the filter state. * @param filter Filter * @param force_visible Whether to force all items visible, no matter what (due to filter text; not affected by restriction drop down box). * @return true if item remains visible */
| 215 | * @return true if item remains visible |
| 216 | */ |
| 217 | bool SettingEntry::UpdateFilterState(SettingFilter &filter, bool force_visible) |
| 218 | { |
| 219 | this->flags.Reset(SettingEntryFlag::Filtered); |
| 220 | |
| 221 | bool visible = true; |
| 222 | |
| 223 | const IntSettingDesc *sd = this->setting; |
| 224 | if (!force_visible && !filter.string.IsEmpty()) { |
| 225 | /* Process the search text filter for this item. */ |
| 226 | filter.string.ResetState(); |
| 227 | |
| 228 | filter.string.AddLine(GetString(sd->GetTitle(), STR_EMPTY)); |
| 229 | filter.string.AddLine(GetString(sd->GetHelp())); |
| 230 | |
| 231 | visible = filter.string.GetState(); |
| 232 | } |
| 233 | |
| 234 | if (visible) { |
| 235 | if (filter.type != ST_ALL && sd->GetType() != filter.type) { |
| 236 | filter.type_hides = true; |
| 237 | visible = false; |
| 238 | } |
| 239 | if (!this->IsVisibleByRestrictionMode(filter.mode)) { |
| 240 | while (filter.min_cat < RM_ALL && (filter.min_cat == filter.mode || !this->IsVisibleByRestrictionMode(filter.min_cat))) filter.min_cat++; |
| 241 | visible = false; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | if (!visible) this->flags.Set(SettingEntryFlag::Filtered); |
| 246 | return visible; |
| 247 | } |
| 248 | |
| 249 | const void *ResolveObject(const GameSettings *settings_ptr, const IntSettingDesc *sd) |
| 250 | { |
no test coverage detected