mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
[7690] Move GetCreature/GetGameobject to class Map. Author: VladimirMangos
* This let get objects at map without reference to player or another object.
* Simplify future implementation for per-map storage for like objects
--HG--
branch : trunk
This commit is contained in:
@@ -57,23 +57,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
||||
if(Creature *unit = GetVehicle(guid))
|
||||
return unit;
|
||||
|
||||
return GetCreature(u, guid);
|
||||
}
|
||||
|
||||
Creature*
|
||||
ObjectAccessor::GetCreature(WorldObject const &u, uint64 guid)
|
||||
{
|
||||
Creature * ret = GetObjectInWorld(guid, (Creature*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
|
||||
if(ret->GetMapId() != u.GetMapId())
|
||||
return NULL;
|
||||
|
||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
return u.GetMap()->GetCreature(guid);
|
||||
}
|
||||
|
||||
Unit*
|
||||
@@ -119,13 +103,13 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
|
||||
|
||||
if(typemask & TYPEMASK_GAMEOBJECT)
|
||||
{
|
||||
obj = GetGameObject(p,guid);
|
||||
obj = p.GetMap()->GetGameObject(guid);
|
||||
if(obj) return obj;
|
||||
}
|
||||
|
||||
if(typemask & TYPEMASK_DYNAMICOBJECT)
|
||||
{
|
||||
obj = GetDynamicObject(p,guid);
|
||||
obj = p.GetMap()->GetDynamicObject(guid);
|
||||
if(obj) return obj;
|
||||
}
|
||||
|
||||
@@ -138,32 +122,6 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GameObject*
|
||||
ObjectAccessor::GetGameObject(WorldObject const &u, uint64 guid)
|
||||
{
|
||||
GameObject * ret = GetObjectInWorld(guid, (GameObject*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
if(ret->GetMapId() != u.GetMapId())
|
||||
return NULL;
|
||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
DynamicObject*
|
||||
ObjectAccessor::GetDynamicObject(WorldObject const &u, uint64 guid)
|
||||
{
|
||||
DynamicObject * ret = GetObjectInWorld(guid, (DynamicObject*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
if(ret->GetMapId() != u.GetMapId())
|
||||
return NULL;
|
||||
if(ret->GetInstanceId() != u.GetInstanceId())
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Player*
|
||||
ObjectAccessor::FindPlayer(uint64 guid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user