fix option searching

This commit is contained in:
yugecin 2017-01-29 16:53:14 +01:00
parent 49c6542fb4
commit 59ef4b37e5
2 changed files with 7 additions and 14 deletions

View File

@ -1210,7 +1210,7 @@ public class Options {
filtered = false; filtered = false;
return false; return false;
} }
filtered = !(displayName.toLowerCase().contains(searchString) || description.toLowerCase().contains(searchString)); filtered = !name.toLowerCase().contains(searchString) && !description.toLowerCase().contains(searchString);
return filtered; return filtered;
} }

View File

@ -870,8 +870,7 @@ public class OptionsOverlay extends OverlayOpsuState {
private void updateSearch() { private void updateSearch() {
OptionTab lastBigSection = null; OptionTab lastBigSection = null;
boolean lastBigSectionMatches = false; boolean lastBigSectionMatches = false;
for (int sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) { for (OptionTab section : sections) {
OptionTab section = sections[sectionIndex];
boolean sectionMatches = section.name.toLowerCase().contains(lastSearchText); boolean sectionMatches = section.name.toLowerCase().contains(lastSearchText);
if (section.options == null) { if (section.options == null) {
lastBigSectionMatches = sectionMatches; lastBigSectionMatches = sectionMatches;
@ -879,23 +878,17 @@ public class OptionsOverlay extends OverlayOpsuState {
section.filtered = true; section.filtered = true;
continue; continue;
} }
boolean allOptionsHidden = true; section.filtered = true;
for (int optionIndex = 0; optionIndex < section.options.length; optionIndex++) { for (GameOption option : section.options) {
GameOption option = section.options[optionIndex];
if (lastBigSectionMatches || sectionMatches) { if (lastBigSectionMatches || sectionMatches) {
allOptionsHidden = false; section.filtered = false;
option.filter(null); option.filter(null);
continue; continue;
} }
if (!option.filter(lastSearchText)) { if (!option.filter(lastSearchText)) {
allOptionsHidden = false;
}
}
if (allOptionsHidden) {
section.filtered = true;
} else {
lastBigSection.filtered = false;
section.filtered = false; section.filtered = false;
lastBigSection.filtered = false;
}
} }
} }
updateHoverOption(prevMouseX, prevMouseY); updateHoverOption(prevMouseX, prevMouseY);