mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
[8026] Obtain object's map directly by calling appropriate WorldObject::GetMap()/GetBaseMap() functions instead of accessing MapManager. Code cleanups. Big thanks Infinity for tests. Author: Ambal
--HG-- branch : trunk
This commit is contained in:
@@ -1101,17 +1101,17 @@ void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint
|
||||
|
||||
uint32 WorldObject::GetZoneId() const
|
||||
{
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
||||
return GetBaseMap()->GetZoneId(m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
uint32 WorldObject::GetAreaId() const
|
||||
{
|
||||
return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
||||
return GetBaseMap()->GetAreaId(m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const
|
||||
{
|
||||
MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
||||
GetBaseMap()->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ);
|
||||
}
|
||||
|
||||
InstanceData* WorldObject::GetInstanceData()
|
||||
@@ -1448,7 +1448,7 @@ void WorldObject::GetRandomPoint( float x, float y, float z, float distance, flo
|
||||
|
||||
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
|
||||
{
|
||||
float new_z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(x,y,z,true);
|
||||
float new_z = GetBaseMap()->GetHeight(x,y,z,true);
|
||||
if(new_z > INVALID_HEIGHT)
|
||||
z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface
|
||||
}
|
||||
@@ -1679,7 +1679,7 @@ Map* WorldObject::_findMap()
|
||||
|
||||
Map const* WorldObject::GetBaseMap() const
|
||||
{
|
||||
return MapManager::Instance().GetBaseMap(GetMapId());
|
||||
return MapManager::Instance().CreateBaseMap(GetMapId());
|
||||
}
|
||||
|
||||
void WorldObject::AddObjectToRemoveList()
|
||||
|
||||
Reference in New Issue
Block a user