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@a2d396eb0b
* 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
This commit is contained in:
Shauren
2015-02-25 00:13:14 +01:00
parent 455ef1a64a
commit ca83e14f8b
89 changed files with 1373 additions and 1217 deletions

View File

@@ -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