diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index e14f3eff684..12978474a41 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -33,8 +33,14 @@ namespace std::unordered_map _liquidTypes; } -bool checkDirectories(bool debugOutput) +bool checkDirectories(bool debugOutput, std::vector& dbcLocales) { + if (getDirContents(dbcLocales, "dbc") == LISTFILE_DIRECTORY_NOT_FOUND || dbcLocales.empty()) + { + printf("'dbc' directory is empty or does not exist\n"); + return false; + } + std::vector dirFiles; if (getDirContents(dirFiles, "maps") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty()) @@ -43,13 +49,6 @@ bool checkDirectories(bool debugOutput) return false; } - dirFiles.clear(); - if (getDirContents(dirFiles, "dbc") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty()) - { - printf("'dbc' directory is empty or does not exist\n"); - return false; - } - dirFiles.clear(); if (getDirContents(dirFiles, "vmaps", "*.vmtree") == LISTFILE_DIRECTORY_NOT_FOUND || dirFiles.empty()) { @@ -250,11 +249,11 @@ int finish(char const* message, int returnValue) return returnValue; } -std::unordered_map LoadLiquid() +std::unordered_map LoadLiquid(std::string const& locale) { DBCFileLoader* liquidDbc = new DBCFileLoader(); std::unordered_map liquidData; - std::string liquidTypeSource = (boost::filesystem::path("dbc") / "LiquidType.dbc").string(); + std::string liquidTypeSource = (boost::filesystem::path("dbc") / locale / "LiquidType.dbc").string(); char const* liquidTypeFmt = "nxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; if (liquidDbc->Load(liquidTypeSource.c_str(), liquidTypeFmt)) @@ -269,11 +268,11 @@ std::unordered_map LoadLiquid() return liquidData; } -std::unordered_map> LoadMap() +std::unordered_map> LoadMap(std::string const& locale) { DBCFileLoader* mapDbc = new DBCFileLoader; std::unordered_map> mapData; - std::string mapSource = (boost::filesystem::path("dbc") / "Map.dbc").string(); + std::string mapSource = (boost::filesystem::path("dbc") / locale / "Map.dbc").string(); char const* mapFmt = "nxxxxxxxxxxxxxxxxxxi"; if (mapDbc->Load(mapSource.c_str(), mapFmt)) @@ -329,16 +328,17 @@ int main(int argc, char** argv) } - if (!checkDirectories(debugOutput)) + std::vector dbcLocales; + if (!checkDirectories(debugOutput, dbcLocales)) return silent ? -3 : finish("Press ENTER to close...", -3); - _liquidTypes = LoadLiquid(); + _liquidTypes = LoadLiquid(dbcLocales[0]); if (_liquidTypes.empty()) - return silent ? -5 : finish("Failed to load LiquidType.db2", -5); + return silent ? -5 : finish("Failed to load LiquidType.dbc", -5); - std::unordered_map> mapData = LoadMap(); + std::unordered_map> mapData = LoadMap(dbcLocales[0]); if (mapData.empty()) - return silent ? -4 : finish("Failed to load Map.db2", -4); + return silent ? -4 : finish("Failed to load Map.dbc", -4); static_cast(VMAP::VMapFactory::createOrGetVMapManager())->InitializeThreadUnsafe(mapData); static_cast(VMAP::VMapFactory::createOrGetVMapManager())->GetLiquidFlagsPtr = [](uint32 liquidId) -> uint32