diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 15c55a11be6..400a885d923 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1734,6 +1734,20 @@ void ObjectMgr::LoadCreatures() data.orientation = Position::NormalizeOrientation(data.orientation); } + if (sWorld->getBoolConfig(CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA)) + { + uint32 zoneId = sMapMgr->GetZoneId(data.mapid, data.posX, data.posY, data.posZ); + uint32 areaId = sMapMgr->GetAreaId(data.mapid, data.posX, data.posY, data.posZ); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_ZONE_AREA_DATA); + + stmt->setUInt32(0, zoneId); + stmt->setUInt32(1, areaId); + stmt->setUInt64(2, guid); + + WorldDatabase.Execute(stmt); + } + // Add to grid if not managed by the game event or pool system if (gameEvent == 0 && PoolId == 0) AddCreatureToGrid(guid, &data); @@ -2046,6 +2060,20 @@ void ObjectMgr::LoadGameobjects() data.phaseMask = 1; } + if (sWorld->getBoolConfig(CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA)) + { + uint32 zoneId = sMapMgr->GetZoneId(data.mapid, data.posX, data.posY, data.posZ); + uint32 areaId = sMapMgr->GetAreaId(data.mapid, data.posX, data.posY, data.posZ); + + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_GAMEOBJECT_ZONE_AREA_DATA); + + stmt->setUInt32(0, zoneId); + stmt->setUInt32(1, areaId); + stmt->setUInt64(2, guid); + + WorldDatabase.Execute(stmt); + } + if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system AddGameobjectToGrid(guid, &data); ++count; |