diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-10-05 01:56:16 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-10-05 01:57:37 +0200 |
commit | f989c7182c4cc30f1d0ffdc566c7624a5e108a2f (patch) | |
tree | 710b3debca58d2625e94996e54d23c8affabebd8 /src/server/game/Globals/ObjectMgr.cpp | |
parent | 5a8f27dda1c62ea609d425109caf6e3e424a34ed (diff) |
Core/Misc: Added support for calculate zoneId/areaId for creature / gameoject table at loading (Slow server startup ca.3-4 sec.)
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; |