diff options
-rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 2 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 24 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.h | 1 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 5233af5abc9..50cdc816e42 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -178,7 +178,7 @@ void DB2Manager::LoadStores(std::string const& dataPath) { uint32 oldMSTime = getMSTime(); - std::string db2Path = dataPath + "dbc/"; + std::string db2Path = GetDBCLocaleFolder(dataPath); DB2StoreProblemList bad_db2_files; uint32 availableDb2Locales = 0xFF; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index f819341a04a..6dc364a412d 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -23,7 +23,9 @@ #include "DBCfmt.h" #include "Timer.h" #include "DB2Stores.h" +#include "Config.h" +#include <boost/filesystem.hpp> #include <map> typedef std::map<uint16, uint32> AreaFlagByAreaID; @@ -302,7 +304,7 @@ void LoadDBCStores(const std::string& dataPath) { uint32 oldMSTime = getMSTime(); - std::string dbcPath = dataPath+"dbc/"; + std::string dbcPath = GetDBCLocaleFolder(dataPath); StoreProblemList bad_dbc_files; uint32 availableDbcLocales = 0xFFFFFFFF; @@ -532,7 +534,7 @@ void LoadGameTables(const std::string& dataPath) { uint32 oldMSTime = getMSTime(); - std::string dbcPath = dataPath + "dbc/"; + std::string dbcPath = GetDBCLocaleFolder(dataPath); StoreProblemList bad_dbc_files; @@ -918,3 +920,21 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u return NULL; } + +std::string GetDBCLocaleFolder(std::string const& dataPath) +{ + using namespace boost::filesystem; + + const std::string dbcPath = dataPath + "dbc/"; + directory_iterator dir_iter(dbcPath); + directory_iterator end_iter; + + const int locale = sConfigMgr->GetIntDefault("DBC.Locale", LOCALE_enUS); + for(; dir_iter != end_iter; ++dir_iter) + if (is_directory(*dir_iter) && GetLocaleByName((*dir_iter).path().filename().string()) == locale) + // Return the full path appending detected locale folder + return (*dir_iter).path().string() + "/"; + + // Empty folder, or it has files but not subfolders (probably the DBC files). + return dbcPath; +} diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 0ec7df693ee..041ce4f5013 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -228,5 +228,6 @@ extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore; void LoadDBCStores(const std::string& dataPath); void LoadGameTables(const std::string& dataPath); +std::string GetDBCLocaleFolder(std::string const& dataPath); #endif |