diff options
author | Carbenium <carbenium@outlook.com> | 2015-09-23 20:21:20 +0200 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2015-09-23 20:21:20 +0200 |
commit | ff31a1d9eddccca5f8077bb35cd5a7f7740f467d (patch) | |
tree | 93a1bc20a25da58e73f356c8dfa14b4b07154748 /src/server/game/Pools/PoolMgr.cpp | |
parent | d476e0eff24af5849bbbc21128aa461a24d4fe9b (diff) | |
parent | dcb7082277447c21b11c4a1d59f105fa342c172e (diff) |
Merge pull request #15313 from pete318/map_local_guid_335
[3.3.5/Core/Map] map local guids 6.x -> 3.3.5
Diffstat (limited to 'src/server/game/Pools/PoolMgr.cpp')
-rw-r--r-- | src/server/game/Pools/PoolMgr.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 3f561539917..8f3d4a758f3 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -221,8 +221,17 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid) { sObjectMgr->RemoveCreatureFromGrid(guid, data); - if (Creature* creature = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_UNIT, 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;) + { + Creature* creature = itr->second; + ++itr; + creature->AddObjectToRemoveList(); + } + } } } @@ -234,8 +243,17 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid) { sObjectMgr->RemoveGameobjectFromGrid(guid, data); - if (GameObject* pGameobject = ObjectAccessor::GetObjectInWorld(ObjectGuid(HIGHGUID_GAMEOBJECT, 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;) + { + GameObject* go = itr->second; + ++itr; + go->AddObjectToRemoveList(); + } + } } } @@ -507,20 +525,16 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 // 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(HIGHGUID_UNIT, 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(HIGHGUID_GAMEOBJECT, 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 |