mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[7690] Move GetCreature/GetGameobject to class Map.
* This let get objects at map without reference to player or another object. * Simplify future implementation for per-map storage for like objects
This commit is contained in:
parent
ee9ea143d1
commit
fc0e1ecdf1
20 changed files with 118 additions and 127 deletions
|
|
@ -55,23 +55,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*
|
||||
|
|
@ -117,13 +101,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;
|
||||
}
|
||||
|
||||
|
|
@ -136,32 +120,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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue