aboutsummaryrefslogtreecommitdiff
path: root/src/common/Common.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-06-30 00:22:25 +0200
committerShauren <shauren.trinity@gmail.com>2020-06-30 00:22:25 +0200
commit79cd94d26df33a332586b2aa72a99b123199c88f (patch)
treedba4de419d8c470b4f932702d0ba71da569c9e03 /src/common/Common.h
parent40c71ea9fca547f2a6fd547cb1cd35af361c4f3c (diff)
Core/Misc: Changed GetLocaleByName to return invalid value on invalid input instead of LOCALE_enUS
* Also added IsValidLocale helper function
Diffstat (limited to 'src/common/Common.h')
-rw-r--r--src/common/Common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 732583da0de..f35773e7c70 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -101,6 +101,11 @@ TC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
TC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name);
+constexpr inline bool IsValidLocale(LocaleConstant locale)
+{
+ return locale < TOTAL_LOCALES&& locale != LOCALE_none;
+}
+
#pragma pack(push, 1)
struct LocalizedString