diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index a3a292c27e0..53e9b116317 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -46,6 +46,7 @@ #include "Util.h" #include "Vehicle.h" #include "World.h" +#include "VMapFactory.h" ScriptMapMap sSpellScripts; ScriptMapMap sEventScripts; @@ -1834,6 +1835,22 @@ void ObjectMgr::LoadCreatures() continue; } + if (sWorld->getBoolConfig(CONFIG_CREATURE_CHECK_INVALID_POSITION)) + if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager()) + { + if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapid)) + { + GridCoord gridCoord = Trinity::ComputeGridCoord(data.posX, data.posY); + 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) + 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); + } + } + // Skip spawnMask check for transport maps if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid]) TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); @@ -2154,6 +2171,22 @@ void ObjectMgr::LoadGameobjects() continue; } + if (sWorld->getBoolConfig(CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION)) + if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager()) + { + if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapid)) + { + GridCoord gridCoord = Trinity::ComputeGridCoord(data.posX, data.posY); + 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) + 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); + } + } + if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction()) { TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); |