GUI: make parsing of GUI options more precise

The parsing was rather lazy and would e. g. find "ega" in "midiSegaCD", so that the launcher offered me an "EGA" rendering mode for EOB SegaCD. Now, there is less lenience, but ScummVM will always write the string in the correct format anyway...
This commit is contained in:
athrxx
2021-11-15 16:18:56 +01:00
parent 326387a373
commit 9e92ffea44
+9 -3
View File
@@ -112,9 +112,15 @@ bool checkGameGUIOption(const String &option, const String &str) {
String parseGameGUIOptions(const String &str) {
String res;
for (int i = 0; g_gameOptions[i].desc; i++)
if (str.contains(g_gameOptions[i].desc))
res += g_gameOptions[i].option;
for (int i = 0; g_gameOptions[i].desc; i++) {
for (uint32 ii = 0; ii < str.size(); ++ii) {
uint32 c_end = str.find(' ', ii);
if (c_end == (uint32)-1)
c_end = str.size();
if (str.substr(ii, c_end - ii).equals((g_gameOptions[i].desc)))
res += g_gameOptions[i].option;
}
}
return res;
}