mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +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
|
|
@ -2531,3 +2531,45 @@ void BattleGroundMap::UnloadAll(bool pForce)
|
|||
|
||||
Map::UnloadAll(pForce);
|
||||
}
|
||||
|
||||
Creature*
|
||||
Map::GetCreature(uint64 guid)
|
||||
{
|
||||
Creature * ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
|
||||
if(ret->GetMapId() != GetId())
|
||||
return NULL;
|
||||
|
||||
if(ret->GetInstanceId() != GetInstanceId())
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GameObject*
|
||||
Map::GetGameObject(uint64 guid)
|
||||
{
|
||||
GameObject * ret = ObjectAccessor::GetObjectInWorld(guid, (GameObject*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
if(ret->GetMapId() != GetId())
|
||||
return NULL;
|
||||
if(ret->GetInstanceId() != GetInstanceId())
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
DynamicObject*
|
||||
Map::GetDynamicObject(uint64 guid)
|
||||
{
|
||||
DynamicObject * ret = ObjectAccessor::GetObjectInWorld(guid, (DynamicObject*)NULL);
|
||||
if(!ret)
|
||||
return NULL;
|
||||
if(ret->GetMapId() != GetId())
|
||||
return NULL;
|
||||
if(ret->GetInstanceId() != GetInstanceId())
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue