From b8bb108757b8abecec13f3178048dcd3abf422b4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 10 May 2011 21:58:20 +0400 Subject: [PATCH] [11466] Use ObjectGuid in Map::m_objectsStore --- src/game/Creature.cpp | 4 ++-- src/game/DynamicObject.cpp | 4 ++-- src/game/GameObject.cpp | 4 ++-- src/game/Map.cpp | 8 ++++---- src/game/Map.h | 5 +++-- src/game/Pet.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index f48538b74..b8f41d369 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -191,7 +191,7 @@ void Creature::AddToWorld() { ///- Register the creature for guid lookup if (!IsInWorld() && GetObjectGuid().IsCreatureOrVehicle()) - GetMap()->GetObjectsStore().insert(GetGUID(), (Creature*)this); + GetMap()->GetObjectsStore().insert(GetObjectGuid(), (Creature*)this); Unit::AddToWorld(); } @@ -200,7 +200,7 @@ void Creature::RemoveFromWorld() { ///- Remove the creature from the accessor if (IsInWorld() && GetObjectGuid().IsCreatureOrVehicle()) - GetMap()->GetObjectsStore().erase(GetGUID(), (Creature*)NULL); + GetMap()->GetObjectsStore().erase(GetObjectGuid(), (Creature*)NULL); Unit::RemoveFromWorld(); } diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index e8701a377..998e3e21a 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -41,7 +41,7 @@ void DynamicObject::AddToWorld() { ///- Register the dynamicObject for guid lookup if(!IsInWorld()) - GetMap()->GetObjectsStore().insert(GetGUID(), (DynamicObject*)this); + GetMap()->GetObjectsStore().insert(GetObjectGuid(), (DynamicObject*)this); Object::AddToWorld(); } @@ -51,7 +51,7 @@ void DynamicObject::RemoveFromWorld() ///- Remove the dynamicObject from the accessor if(IsInWorld()) { - GetMap()->GetObjectsStore().erase(GetGUID(), (DynamicObject*)NULL); + GetMap()->GetObjectsStore().erase(GetObjectGuid(), (DynamicObject*)NULL); GetViewPoint().Event_RemovedFromWorld(); } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 95fcf22c5..ba9e6802a 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -68,7 +68,7 @@ void GameObject::AddToWorld() { ///- Register the gameobject for guid lookup if(!IsInWorld()) - GetMap()->GetObjectsStore().insert(GetGUID(), (GameObject*)this); + GetMap()->GetObjectsStore().insert(GetObjectGuid(), (GameObject*)this); Object::AddToWorld(); } @@ -91,7 +91,7 @@ void GameObject::RemoveFromWorld() } } - GetMap()->GetObjectsStore().erase(GetGUID(), (GameObject*)NULL); + GetMap()->GetObjectsStore().erase(GetObjectGuid(), (GameObject*)NULL); } Object::RemoveFromWorld(); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index a39022bda..becdec24b 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2902,7 +2902,7 @@ Player* Map::GetPlayer(ObjectGuid guid) */ Creature* Map::GetCreature(ObjectGuid guid) { - return m_objectsStore.find(guid.GetRawValue(), (Creature*)NULL); + return m_objectsStore.find(guid, (Creature*)NULL); } /** @@ -2912,7 +2912,7 @@ Creature* Map::GetCreature(ObjectGuid guid) */ Pet* Map::GetPet(ObjectGuid guid) { - return m_objectsStore.find(guid.GetRawValue(), (Pet*)NULL); + return m_objectsStore.find(guid, (Pet*)NULL); } /** @@ -2953,7 +2953,7 @@ Creature* Map::GetAnyTypeCreature(ObjectGuid guid) */ GameObject* Map::GetGameObject(ObjectGuid guid) { - return m_objectsStore.find(guid.GetRawValue(), (GameObject*)NULL); + return m_objectsStore.find(guid, (GameObject*)NULL); } /** @@ -2963,7 +2963,7 @@ GameObject* Map::GetGameObject(ObjectGuid guid) */ DynamicObject* Map::GetDynamicObject(ObjectGuid guid) { - return m_objectsStore.find(guid.GetRawValue(), (DynamicObject*)NULL); + return m_objectsStore.find(guid, (DynamicObject*)NULL); } /** diff --git a/src/game/Map.h b/src/game/Map.h index cddc8683c..3dde4d9a9 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -230,7 +230,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager Unit* GetUnit(ObjectGuid guid); // only use if sure that need objects at current map, specially for player case WorldObject* GetWorldObject(ObjectGuid guid); // only use if sure that need objects at current map, specially for player case - TypeUnorderedMapContainer& GetObjectsStore() { return m_objectsStore; } + typedef TypeUnorderedMapContainer MapStoredObjectTypesContainer; + MapStoredObjectTypesContainer& GetObjectsStore() { return m_objectsStore; } void AddUpdateObject(Object *obj) { @@ -304,7 +305,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager typedef std::set ActiveNonPlayers; ActiveNonPlayers m_activeNonPlayers; ActiveNonPlayers::iterator m_activeNonPlayersIter; - TypeUnorderedMapContainer m_objectsStore; + MapStoredObjectTypesContainer m_objectsStore; private: time_t i_gridExpiry; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index d3d10315e..4630e6926 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -58,7 +58,7 @@ void Pet::AddToWorld() { ///- Register the pet for guid lookup if(!IsInWorld()) - GetMap()->GetObjectsStore().insert(GetGUID(), (Pet*)this); + GetMap()->GetObjectsStore().insert(GetObjectGuid(), (Pet*)this); Unit::AddToWorld(); } @@ -67,7 +67,7 @@ void Pet::RemoveFromWorld() { ///- Remove the pet from the accessor if(IsInWorld()) - GetMap()->GetObjectsStore().erase(GetGUID(), (Pet*)NULL); + GetMap()->GetObjectsStore().erase(GetObjectGuid(), (Pet*)NULL); ///- Don't call the function for Creature, normal mobs + totems go in a different storage Unit::RemoveFromWorld(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b2ccb7a64..b66210116 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11465" + #define REVISION_NR "11466" #endif // __REVISION_NR_H__