mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9168] Correctly work with alternative locale names.
Allow use enGB locale subdirectory for DBC files.
This commit is contained in:
parent
3d7d7fd512
commit
e246b49e55
4 changed files with 37 additions and 9 deletions
|
|
@ -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<<i); // mark as not available for speedup next checks
|
||||
}
|
||||
|
|
@ -212,6 +212,8 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
barGoLink bar( DBCFilesCount );
|
||||
|
||||
StoreProblemList bad_dbc_files;
|
||||
|
||||
// bitmask for index of fullLocaleNameList
|
||||
uint32 availableDbcLocales = 0xFFFFFFFF;
|
||||
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaStore, dbcPath,"AreaTable.dbc");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "Common.h"
|
||||
|
||||
char const* localeNames[MAX_LOCALE] = {
|
||||
"enUS",
|
||||
"enUS", // also enGB
|
||||
"koKR",
|
||||
"frFR",
|
||||
"deDE",
|
||||
|
|
@ -30,11 +30,27 @@ char const* localeNames[MAX_LOCALE] = {
|
|||
"ruRU"
|
||||
};
|
||||
|
||||
// used for search by name or iterate all names
|
||||
LocaleNameStr fullLocaleNameList[] =
|
||||
{
|
||||
{ "enUS", LOCALE_enUS },
|
||||
{ "enGB", LOCALE_enUS },
|
||||
{ "koKR", LOCALE_koKR },
|
||||
{ "frFR", LOCALE_frFR },
|
||||
{ "deDE", LOCALE_deDE },
|
||||
{ "zhCN", LOCALE_zhCN },
|
||||
{ "zhTW", LOCALE_zhTW },
|
||||
{ "esES", LOCALE_esES },
|
||||
{ "esMX", LOCALE_esMX },
|
||||
{ "ruRU", LOCALE_ruRU },
|
||||
{ NULL, LOCALE_enUS }
|
||||
};
|
||||
|
||||
LocaleConstant GetLocaleByName(const std::string& name)
|
||||
{
|
||||
for(uint32 i = 0; i < MAX_LOCALE; ++i)
|
||||
if(name==localeNames[i])
|
||||
return LocaleConstant(i);
|
||||
for(LocaleNameStr* itr = &fullLocaleNameList[0]; itr->name; ++itr)
|
||||
if (name==itr->name)
|
||||
return itr->locale;
|
||||
|
||||
return LOCALE_enUS; // including enGB case
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9167"
|
||||
#define REVISION_NR "9168"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue