From 88f77807aeab9f355936e7ab82eecd6d57efa02b Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 13 Jan 2010 07:49:16 +0300 Subject: [PATCH] [9168] Correctly work with alternative locale names. Allow use enGB locale subdirectory for DBC files. --- src/game/DBCStores.cpp | 6 ++++-- src/shared/Common.cpp | 24 ++++++++++++++++++++---- src/shared/Common.h | 14 ++++++++++++-- src/shared/revision_nr.h | 2 +- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index ff4ce8811..934d124d8 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -177,12 +177,12 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList if(storage.Load(dbc_filename.c_str())) { bar.step(); - for(uint8 i = 0; i < MAX_LOCALE; ++i) + for(uint8 i = 0; fullLocaleNameList[i].name; ++i) { if(!(availableDbcLocales & (1 << i))) continue; - std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename; + std::string dbc_filename_loc = dbc_path + fullLocaleNameList[i].name + "/" + filename; if(!storage.LoadStringsFrom(dbc_filename_loc.c_str())) availableDbcLocales &= ~(1<name; ++itr) + if (name==itr->name) + return itr->locale; return LOCALE_enUS; // including enGB case } diff --git a/src/shared/Common.h b/src/shared/Common.h index 2f55b2674..f7d303e82 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -173,7 +173,7 @@ enum AccountTypes enum LocaleConstant { - LOCALE_enUS = 0, + LOCALE_enUS = 0, // also enGB LOCALE_koKR = 1, LOCALE_frFR = 2, LOCALE_deDE = 3, @@ -186,9 +186,19 @@ enum LocaleConstant #define MAX_LOCALE 9 +LocaleConstant GetLocaleByName(const std::string& name); + extern char const* localeNames[MAX_LOCALE]; -LocaleConstant GetLocaleByName(const std::string& name); +struct LocaleNameStr +{ + char const* name; + LocaleConstant locale; +}; + +// used for iterate all names including alternative +extern LocaleNameStr fullLocaleNameList[]; + //operator new[] based version of strdup() function! Release memory by using operator delete[] ! inline char * mangos_strdup(const char * source) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5ef58e304..b601c8e43 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9167" + #define REVISION_NR "9168" #endif // __REVISION_NR_H__ -- 2.11.4.GIT