diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/util.cpp | 21 | ||||
-rw-r--r-- | common/util.h | 4 |
2 files changed, 22 insertions, 3 deletions
diff --git a/common/util.cpp b/common/util.cpp index 895bcebef7..b8bd327a0a 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -322,9 +322,26 @@ bool checkGameGUIOption(GameGUIOption option, const String &str) { return false; } +bool checkGameGUIOptionLanguage(Language lang, const String &str) { + if (!str.contains("lang_")) // If no languages are specified + return true; + + if (str.contains(getGameGUIOptionsDescriptionLanguage(lang))) + return true; + + return false; +} + +const String getGameGUIOptionsDescriptionLanguage(Language lang) { + if (lang == UNK_LANG) + return ""; + + return String(String("lang_") + getLanguageDescription(lang)); +} + uint32 parseGameGUIOptions(const String &str) { uint32 res = 0; - + for (int i = 0; g_gameOptions[i].desc; i++) if (str.contains(g_gameOptions[i].desc)) res |= g_gameOptions[i].option; @@ -332,7 +349,7 @@ uint32 parseGameGUIOptions(const String &str) { return res; } -String getGameGUIOptionsDescription(uint32 options) { +const String getGameGUIOptionsDescription(uint32 options) { String res = ""; for (int i = 0; g_gameOptions[i].desc; i++) diff --git a/common/util.h b/common/util.h index 62c8f0d1fb..71456353c7 100644 --- a/common/util.h +++ b/common/util.h @@ -228,8 +228,10 @@ enum GameGUIOption { }; bool checkGameGUIOption(GameGUIOption option, const String &str); +bool checkGameGUIOptionLanguage(Language lang, const String &str); uint32 parseGameGUIOptions(const String &str); -String getGameGUIOptionsDescription(uint32 options); +const String getGameGUIOptionsDescription(uint32 options); +const String getGameGUIOptionsDescriptionLanguage(Language lang); /** * Updates the GUI options of the current config manager |