diff options
-rw-r--r-- | src/server/game/World/World.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 4b31ea6fbff..f080cc537a7 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2247,27 +2247,30 @@ void World::DetectDBCLang() std::string availableLocalsStr; uint8 default_locale = TOTAL_LOCALES; - for (uint8 i = default_locale-1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8 + for (uint8 i = LOCALE_enUS; i < TOTAL_LOCALES; ++i) { if (race->Name[i][0] != '\0') // check by race names { - default_locale = i; + // Mark the first found locale as default locale + if (default_locale == TOTAL_LOCALES) + default_locale = i; + m_availableDbcLocaleMask |= (1 << i); availableLocalsStr += localeNames[i]; availableLocalsStr += " "; } } - if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES && - (m_availableDbcLocaleMask & (1 << m_lang_confid))) + if (m_availableDbcLocaleMask == 0) { - default_locale = m_lang_confid; + TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)"); + exit(1); } - if (default_locale >= TOTAL_LOCALES) + if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES && + (m_availableDbcLocaleMask & (1 << m_lang_confid))) { - TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)"); - exit(1); + default_locale = m_lang_confid; } m_defaultDbcLocale = LocaleConstant(default_locale); |