From 217a9bb34ddfde128df1567877cbef7df8729c28 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 22 Jan 2017 12:06:02 +0100 Subject: Core/Vmaps: Changed error message when loading outdated vmaps Closes #18431 Closes #18857 (cherry-picked from c90882ed6e2aba3b2d421abdc17cb57bea61d04b) --- src/server/game/Globals/ObjectMgr.cpp | 8 ++++---- src/server/game/Maps/Map.cpp | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src/server') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 746782fa1ec..2dd2753cde3 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1989,8 +1989,8 @@ void ObjectMgr::LoadCreatures() int gx = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord; int gy = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord; - bool exists = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy); - if (!exists) + VMAP::LoadResult result = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy); + if (result != VMAP::LoadResult::Success) TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u MapID: %u) spawned on a possible invalid position (X: %f Y: %f Z: %f)", guid, data.id, data.mapid, data.posX, data.posY, data.posZ); } @@ -2348,8 +2348,8 @@ void ObjectMgr::LoadGameobjects() int gx = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord; int gy = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord; - bool exists = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy); - if (!exists) + VMAP::LoadResult result = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy); + if (result != VMAP::LoadResult::Success) TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u MapID: %u) spawned on a possible invalid position (X: %f Y: %f Z: %f)", guid, data.id, data.mapid, data.posX, data.posY, data.posZ); } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index dfd8b7fd5b7..a0e7043532d 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -125,13 +125,20 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy) { if (vmgr->isMapLoadingEnabled()) { - bool exists = vmgr->existsMap((sWorld->GetDataPath()+ "vmaps").c_str(), mapid, gx, gy); - if (!exists) + VMAP::LoadResult result = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), mapid, gx, gy); + std::string name = vmgr->getDirFileName(mapid, gx, gy); + switch (result) { - std::string name = vmgr->getDirFileName(mapid, gx, gy); - TC_LOG_ERROR("maps", "VMap file '%s' does not exist", (sWorld->GetDataPath()+"vmaps/"+name).c_str()); - TC_LOG_ERROR("maps", "Please place VMAP-files (*.vmtree and *.vmtile) in the vmap-directory (%s), or correct the DataDir setting in your worldserver.conf file.", (sWorld->GetDataPath()+"vmaps/").c_str()); - return false; + case VMAP::LoadResult::Success: + break; + case VMAP::LoadResult::FileNotFound: + TC_LOG_ERROR("maps", "VMap file '%s' does not exist", (sWorld->GetDataPath() + "vmaps/" + name).c_str()); + TC_LOG_ERROR("maps", "Please place VMAP files (*.vmtree and *.vmtile) in the vmap directory (%s), or correct the DataDir setting in your worldserver.conf file.", (sWorld->GetDataPath() + "vmaps/").c_str()); + return false; + case VMAP::LoadResult::VersionMismatch: + TC_LOG_ERROR("maps", "VMap file '%s' couldn't be loaded", (sWorld->GetDataPath() + "vmaps/" + name).c_str()); + TC_LOG_ERROR("maps", "This is because the version of the VMap file and the version of this module are different, please re-extract the maps with the tools compiled with this module."); + return false; } } } -- cgit v1.2.3