diff options
author | megamage <none@none> | 2009-05-23 20:42:31 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-23 20:42:31 -0500 |
commit | 94692ea5f7afddcbf56e4db68b2acb000115e0ec (patch) | |
tree | 11ffdcfd5d967e141953cfc3581138815b075b70 | |
parent | 2475390852e23a938110ba79647a2ccc49a8fc86 (diff) |
*Use getworldobject for getunit. Also allow get vehicles using this function.
--HG--
branch : trunk
-rw-r--r-- | src/game/ObjectAccessor.cpp | 2 | ||||
-rw-r--r-- | src/game/ObjectAccessor.h | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index da6279e068a..0472c89a59f 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -60,6 +60,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid) return u.GetMap()->GetCreature(guid); } +/* Unit* ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid) { @@ -71,6 +72,7 @@ ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid) return GetCreatureOrPetOrVehicle(u, guid); } +*/ Corpse* ObjectAccessor::GetCorpse(WorldObject const &u, uint64 guid) diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index f4452b81cab..1e4074684f1 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -103,13 +103,16 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, if(!guid) return NULL; - if (IS_PLAYER_GUID(guid)) + if(IS_PLAYER_GUID(guid)) return (Unit*)HashMapHolder<Player>::Find(guid); - if (Unit* u = (Unit*)HashMapHolder<Pet>::Find(guid)) - return u; + if(IS_CREATURE_GUID(guid)) + return (Unit*)HashMapHolder<Creature>::Find(guid); - return (Unit*)HashMapHolder<Creature>::Find(guid); + if(IS_PET_GUID(guid)) + return (Unit*)HashMapHolder<Pet>::Find(guid); + + return (Unit*)HashMapHolder<Vehicle>::Find(guid); } template<class T> static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) @@ -140,7 +143,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask); static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64); - static Unit* GetUnit(WorldObject const &, uint64); + static Unit* GetUnit(WorldObject const &, uint64 guid) { return GetObjectInWorld(guid, (Unit*)NULL); } static Pet* GetPet(Unit const &, uint64 guid) { return GetPet(guid); } static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); } static Corpse* GetCorpse(WorldObject const &u, uint64 guid); |