mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8182] Store and use Map* pointer in WorldObject instead map ids for speedup
Also some code logic cleanups. Changes let make more cleanups in base map access and other places, but this chnages not inlcuded in patch. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
fcb34b3928
commit
58209ee79a
25 changed files with 180 additions and 193 deletions
|
|
@ -1049,7 +1049,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const
|
|||
|
||||
WorldObject::WorldObject()
|
||||
: m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL),
|
||||
m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f)
|
||||
m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f), m_currMap(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1057,11 +1057,9 @@ void WorldObject::CleanupsBeforeDelete()
|
|||
{
|
||||
}
|
||||
|
||||
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint32 phaseMask )
|
||||
void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask )
|
||||
{
|
||||
Object::_Create(guidlow, 0, guidhigh);
|
||||
|
||||
m_mapId = mapid;
|
||||
m_phaseMask = phaseMask;
|
||||
}
|
||||
|
||||
|
|
@ -1538,14 +1536,19 @@ void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
|
|||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
Map* WorldObject::GetMap() const
|
||||
void WorldObject::SetMap(Map * map)
|
||||
{
|
||||
return MapManager::Instance().GetMap(GetMapId(), this);
|
||||
ASSERT(map);
|
||||
m_currMap = map;
|
||||
//lets save current map's Id/instanceId
|
||||
m_mapId = map->GetId();
|
||||
m_InstanceId = map->GetInstanceId();
|
||||
}
|
||||
|
||||
Map const* WorldObject::GetBaseMap() const
|
||||
{
|
||||
return MapManager::Instance().CreateBaseMap(GetMapId());
|
||||
ASSERT(m_currMap);
|
||||
return m_currMap->GetParent();
|
||||
}
|
||||
|
||||
void WorldObject::AddObjectToRemoveList()
|
||||
|
|
@ -1557,7 +1560,6 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
{
|
||||
TemporarySummon* pCreature = new TemporarySummon(GetGUID());
|
||||
|
||||
pCreature->SetInstanceId(GetInstanceId());
|
||||
uint32 team = 0;
|
||||
if (GetTypeId()==TYPEID_PLAYER)
|
||||
team = ((Player*)this)->GetTeam();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue