mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
COMMON: Check GUIO constants for duplicates
This commit is contained in:
parent
c7d0594834
commit
c138d170a5
@ -115,6 +115,25 @@ const struct GameOpt {
|
||||
};
|
||||
|
||||
bool checkGameGUIOption(const String &option, const String &str) {
|
||||
#ifndef RELEASE_BUILD
|
||||
static bool firstRun = true;
|
||||
|
||||
// Check GUIO constants for duplicates
|
||||
if (firstRun) {
|
||||
HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> allOptions;
|
||||
|
||||
for (int i = 0; g_gameOptions[i].desc; i++) {
|
||||
if (allOptions.contains(g_gameOptions[i].option)) {
|
||||
error("Duplicate GUIO constant, id: \\x%02x, renumerate them", g_gameOptions[i].option[0]);
|
||||
}
|
||||
|
||||
allOptions[g_gameOptions[i].option] = true;
|
||||
}
|
||||
|
||||
firstRun = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; g_gameOptions[i].desc; i++) {
|
||||
if (option.contains(g_gameOptions[i].option)) {
|
||||
if (str.contains(g_gameOptions[i].desc))
|
||||
@ -147,7 +166,7 @@ const String getGameGUIOptionsDescription(const String &options) {
|
||||
String res;
|
||||
|
||||
for (int i = 0; g_gameOptions[i].desc; i++)
|
||||
if (options.contains(g_gameOptions[i].option[0]))
|
||||
if (options.contains(g_gameOptions[i].option[0]))
|
||||
res += String(g_gameOptions[i].desc) + " ";
|
||||
|
||||
res.trim();
|
||||
|
Loading…
Reference in New Issue
Block a user