aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Pools/PoolMgr.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-02-25 00:13:14 +0100
committerShauren <shauren.trinity@gmail.com>2015-04-28 21:19:46 +0200
commitca83e14f8b141fab0a13e08f48fca6c1ace0c4c7 (patch)
tree68487de0cd291b6aba9131a4eade228433f05d99 /src/server/game/Pools/PoolMgr.cpp
parent455ef1a64af14ee249e270b451f67f552ba3605a (diff)
Core/Entities: Reworked guid scopes
* Added ObjectGuid traits to easily access whether guid type can be generated globally (ObjectMgr) or not * This adds separate (per map) guid sequences depending on object type * Ported map object container from cmangos/mangos-wotlk@a2d396eb0bb195efc460944dd4e0fab2a858b300 * Added type container visitor for TypeUnorderedMapContainer * Implemented helper function to erase unique pairs from multimap containers * Moved object storage of all objects except players and transports to map level * Added containers linking database spawn id with creature/gameobject in world * Renamed DBTableGuid to spawnId * Added a separate spawn id sequence generator for creatures and gameobjects - this will be used in db tables * Moved building SMSG_UPDATE_OBJECT - updatefields changes broadcast to map update
Diffstat (limited to 'src/server/game/Pools/PoolMgr.cpp')
-rw-r--r--src/server/game/Pools/PoolMgr.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 9f8a9f8686b..15f378e138a 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -221,8 +221,13 @@ void PoolGroup<Creature>::Despawn1Object(uint64 guid)
{
sObjectMgr->RemoveCreatureFromGrid(guid, data);
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid::Create<HighGuid::Creature>(data->mapid, data->id, guid), (Creature*)NULL))
- creature->AddObjectToRemoveList();
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
+ if (!map->Instanceable())
+ {
+ auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(guid);
+ for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr)
+ itr->second->AddObjectToRemoveList();
+ }
}
}
@@ -234,8 +239,13 @@ void PoolGroup<GameObject>::Despawn1Object(uint64 guid)
{
sObjectMgr->RemoveGameobjectFromGrid(guid, data);
- if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid::Create<HighGuid::GameObject>(data->mapid, data->id, guid), (GameObject*)NULL))
- pGameobject->AddObjectToRemoveList();
+ Map* map = sMapMgr->CreateBaseMap(data->mapid);
+ if (!map->Instanceable())
+ {
+ auto gameobjectBounds = map->GetGameObjectBySpawnIdStore().equal_range(guid);
+ for (auto itr = gameobjectBounds.first; itr != gameobjectBounds.second; ++itr)
+ itr->second->AddObjectToRemoveList();
+ }
}
}
@@ -507,20 +517,16 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint64
// Method that does the respawn job on the specified creature
template <>
-void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
+void PoolGroup<Creature>::ReSpawn1Object(PoolObject* /*obj*/)
{
- if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid))
- if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid::Create<HighGuid::Creature>(data->mapid, data->id, obj->guid), (Creature*)NULL))
- creature->GetMap()->AddToMap(creature);
+ // Creature is still on map, nothing to do
}
// Method that does the respawn job on the specified gameobject
template <>
-void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj)
+void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* /*obj*/)
{
- if (GameObjectData const* data = sObjectMgr->GetGOData(obj->guid))
- if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid::Create<HighGuid::GameObject>(data->mapid, data->id, obj->guid), (GameObject*)NULL))
- pGameobject->GetMap()->AddToMap(pGameobject);
+ // GameObject is still on map, nothing to do
}
// Nothing to do for a child Pool