Replace some MapManager::Instance().GetMap() calls with WorldObject::GetMap()

This commit is contained in:
hunuza 2008-11-16 12:11:45 +01:00
parent c37cfd0c2f
commit ac00eee418
23 changed files with 105 additions and 105 deletions

View file

@ -607,7 +607,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetRank(0);
}
if (!MapManager::Instance().GetMap(pCurrChar->GetMapId(), pCurrChar)->Add(pCurrChar))
if (!pCurrChar->GetMap()->Add(pCurrChar))
{
AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId());
if(at)

View file

@ -1173,7 +1173,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(pl->GetMapId(), pl));
cell_lock->Visit(cell_lock, object_checker, *pl->GetMap());
}
return obj;

View file

@ -149,7 +149,7 @@ void Creature::RemoveCorpse()
float x,y,z,o;
GetRespawnCoord(x, y, z, &o);
MapManager::Instance().GetMap(GetMapId(), this)->CreatureRelocation(this,x,y,z,o);
GetMap()->CreatureRelocation(this,x,y,z,o);
}
/**
@ -337,7 +337,7 @@ void Creature::Update(uint32 diff)
//Call AI respawn virtual function
i_AI->JustRespawned();
MapManager::Instance().GetMap(GetMapId(), this)->Add(this);
GetMap()->Add(this);
}
break;
}
@ -1686,7 +1686,7 @@ void Creature::CallAssistence()
TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap());
}
for(std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)

View file

@ -122,8 +122,8 @@ void DynamicObject::Update(uint32 p_time)
TypeContainerVisitor<MaNGOS::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_object_notifier, *GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap());
if(deleteThis)
{

View file

@ -258,7 +258,7 @@ void GameObject::Update(uint32 /*p_time*/)
return;
}
// respawn timer
MapManager::Instance().GetMap(GetMapId(), this)->Add(this);
GetMap()->Add(this);
break;
}
}
@ -309,13 +309,13 @@ void GameObject::Update(uint32 /*p_time*/)
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker);
cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_object_checker, *GetMap());
// or unfriendly player/pet
if(!ok)
{
TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_object_checker, *GetMap());
}
}
else // environmental trap
@ -330,7 +330,7 @@ void GameObject::Update(uint32 /*p_time*/)
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_object_checker, *GetMap());
ok = p_ok;
}
@ -444,7 +444,7 @@ void GameObject::Refresh()
return;
if(isSpawned())
MapManager::Instance().GetMap(GetMapId(), this)->Add(this);
GetMap()->Add(this);
}
void GameObject::AddUniqueUse(Player* player)
@ -787,7 +787,7 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, object_checker, *GetMap());
}
// found correct GO
@ -809,7 +809,7 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker);
cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_object_checker, *GetMap());
return ok;
}

View file

@ -288,7 +288,7 @@ bool ChatHandler::HandleGPSCommand(const char* args)
Map2ZoneCoordinates(zone_x,zone_y,zone_id);
Map const *map = MapManager::Instance().GetMap(obj->GetMapId(), obj);
Map const *map = obj->GetMap();
float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);
float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());
@ -349,11 +349,11 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
return false;
}
Map* pMap = MapManager::Instance().GetMap(m_session->GetPlayer()->GetMapId(),m_session->GetPlayer());
Map* pMap = m_session->GetPlayer()->GetMap();
if(pMap->Instanceable())
{
Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr);
Map* cMap = chr->GetMap();
if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() )
{
// cannot summon from instance to instance
@ -435,7 +435,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
Player *chr = objmgr.GetPlayer(name.c_str());
if (chr)
{
Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr);
Map* cMap = chr->GetMap();
if(cMap->Instanceable())
{
// we have to go to instance, and can go to player only if:
@ -2058,7 +2058,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
return false;
}
Map* gmMap = MapManager::Instance().GetMap(m_session->GetPlayer()->GetMapId(),m_session->GetPlayer());
Map* gmMap = m_session->GetPlayer()->GetMap();
bool to_instance = gmMap->Instanceable();
// we are in instance, and can summon only player in our group with us as lead
@ -2088,7 +2088,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
if (to_instance)
{
Map* plMap = MapManager::Instance().GetMap(pl->GetMapId(),pl);
Map* plMap = pl->GetMap();
if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() )
{

View file

@ -1056,7 +1056,7 @@ bool ChatHandler::HandleTurnObjectCommand(const char* args)
float rot2 = sin(o/2);
float rot3 = cos(o/2);
Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj);
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o);
@ -1140,7 +1140,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args)
const_cast<CreatureData*>(data)->posZ = z;
const_cast<CreatureData*>(data)->orientation = o;
}
MapManager::Instance().GetMap(pCreature->GetMapId(),pCreature)->CreatureRelocation(pCreature,x, y, z,o);
pCreature->GetMap()->CreatureRelocation(pCreature,x, y, z,o);
pCreature->GetMotionMaster()->Initialize();
if(pCreature->isAlive()) // dead creature will reset movement generator at respawn
{
@ -1187,7 +1187,7 @@ bool ChatHandler::HandleMoveObjectCommand(const char* args)
{
Player *chr = m_session->GetPlayer();
Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj);
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation());
@ -1213,7 +1213,7 @@ bool ChatHandler::HandleMoveObjectCommand(const char* args)
return false;
}
Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj);
Map* map = obj->GetMap();
map->Remove(obj,false);
obj->Relocate(x, y, z, obj->GetOrientation());
@ -2675,7 +2675,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map);
map->Add(wpCreature2);
//MapManager::Instance().GetMap(npcCreature->GetMapId())->Add(wpCreature2);
//npcCreature->GetMap()->Add(wpCreature2);
}
WaypointMgr.SetNodePosition(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ());
@ -2985,7 +2985,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map);
map->Add(wpCreature);
//MapManager::Instance().GetMap(wpCreature->GetMapId())->Add(wpCreature);
//wpCreature->GetMap()->Add(wpCreature);
}while( result->NextRow() );
// Cleanup memory
@ -4164,7 +4164,7 @@ bool ChatHandler::HandleNpcTameCommand(const char* /*args*/)
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
// add to world
MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
pet->GetMap()->Add((Creature*)pet);
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());

View file

@ -5413,7 +5413,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
TypeContainerVisitor<MaNGOS::WorldObjectWorker<MaNGOS::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, obj_worker, *MapManager::Instance().GetMap(pl->GetMapId(), pl));
cell_lock->Visit(cell_lock, obj_worker, *pl->GetMap());
return true;
}

View file

@ -72,7 +72,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SendInitialPacketsBeforeAddToMap();
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if(!MapManager::Instance().GetMap(GetPlayer()->GetMapId(), GetPlayer())->Add(GetPlayer()))
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
{
sLog.outDebug("WORLD: teleport of player %s (%d) to location %d,%f,%f,%f,%f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.x, loc.y, loc.z, loc.o);
// teleport the player home

View file

@ -976,7 +976,7 @@ uint32 WorldObject::GetAreaId() const
InstanceData* WorldObject::GetInstanceData()
{
Map *map = MapManager::Instance().GetMap(m_mapId, this);
Map *map = GetMap();
return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceData() : NULL;
}
@ -1347,12 +1347,12 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
{
MapManager::Instance().GetMap(m_mapId, this)->MessageBroadcast(this, data);
GetMap()->MessageBroadcast(this, data);
}
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
{
MapManager::Instance().GetMap(m_mapId, this)->MessageDistBroadcast(this, data, dist);
GetMap()->MessageDistBroadcast(this, data, dist);
}
void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
@ -1541,8 +1541,8 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
TypeContainerVisitor<MaNGOS::WorldObjectWorker<MaNGOS::NearUsedPosDo>, WorldTypeMapContainer > world_obj_worker(worker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_obj_worker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_obj_worker, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_obj_worker, *GetMap());
cell_lock->Visit(cell_lock, world_obj_worker, *GetMap());
}
// maybe can just place in primary position

View file

@ -341,7 +341,7 @@ ObjectAccessor::_buildChangeObjectForPlayer(WorldObject *obj, UpdateDataMapType
WorldObjectChangeAccumulator notifier(*obj, update_players);
TypeContainerVisitor<WorldObjectChangeAccumulator, WorldTypeMapContainer > player_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, player_notifier, *MapManager::Instance().GetMap(obj->GetMapId(), obj));
cell_lock->Visit(cell_lock, player_notifier, *obj->GetMap());
}
Pet*
@ -533,14 +533,14 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(p);
MapManager::Instance().GetMap(obj->GetMapId(), obj)->UpdateObjectVisibility(obj,cell,p);
obj->GetMap()->UpdateObjectVisibility(obj,cell,p);
}
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
{
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
Cell cell(p);
Map* m = MapManager::Instance().GetMap(player->GetMapId(),player);
Map* m = player->GetMap();
m->UpdatePlayerVisibility(player,cell,p);
m->UpdateObjectsVisibilityFor(player,cell,p);

View file

@ -68,7 +68,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
if(cur_cell.DiffGrid(resp_cell))
{
MapManager::Instance().GetMap(c->GetMapId(), c)->CreatureRespawnRelocation(c);
c->GetMap()->CreatureRespawnRelocation(c);
// false result ignored: will be unload with other creatures at grid
}
}

View file

@ -1554,7 +1554,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
else
{
// far teleport to another map
Map* oldmap = IsInWorld() ? MapManager::Instance().GetMap(GetMapId(), this) : NULL;
Map* oldmap = IsInWorld() ? GetMap() : NULL;
// check if we can enter before stopping combat / removing pet / totems / interrupting spells
// Check enter rights before map getting to avoid creating instance copy for player
@ -5128,7 +5128,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
return false;
}
Map *m = MapManager::Instance().GetMap(GetMapId(), this);
Map *m = GetMap();
const float old_x = GetPositionX();
const float old_y = GetPositionY();
@ -5146,7 +5146,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele
m->PlayerRelocation(this, x, y, z, orientation);
// reread after Map::Relocation
m = MapManager::Instance().GetMap(GetMapId(), this);
m = GetMap();
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
@ -5175,17 +5175,17 @@ void Player::SaveRecallPosition()
void Player::SendMessageToSet(WorldPacket *data, bool self)
{
MapManager::Instance().GetMap(GetMapId(), this)->MessageBroadcast(this, data, self);
GetMap()->MessageBroadcast(this, data, self);
}
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
{
MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self);
GetMap()->MessageDistBroadcast(this, data, dist, self);
}
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only)
{
MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self,own_team_only);
GetMap()->MessageDistBroadcast(this, data, dist, self,own_team_only);
}
void Player::SendDirectMessage(WorldPacket *data)
@ -16107,8 +16107,8 @@ void Player::HandleStealthedUnitsDetection()
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyStealthedCheck >, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap());
for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end();)
{

View file

@ -475,12 +475,12 @@ void Spell::FillTargetMap()
TypeContainerVisitor<MaNGOS::WorldObjectSearcher<MaNGOS::CannibalizeObjectCheck >, GridTypeMapContainer > grid_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_searcher, *m_caster->GetMap());
if(!result)
{
TypeContainerVisitor<MaNGOS::WorldObjectSearcher<MaNGOS::CannibalizeObjectCheck >, WorldTypeMapContainer > world_searcher(searcher);
cell_lock->Visit(cell_lock, world_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_searcher, *m_caster->GetMap());
}
if(result)
@ -1208,8 +1208,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap());
}
if(tempUnitMap.empty())
@ -1307,8 +1307,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap());
}
tempUnitMap.sort(TargetDistanceOrder(pUnitTarget));
@ -1365,8 +1365,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
// exclude caster (this can be important if this not original caster)
TagUnitMap.remove(m_caster);
@ -1448,8 +1448,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}break;
case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER:
{
@ -1464,8 +1464,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}break;
case TARGET_ALL_FRIENDLY_UNITS_IN_AREA:
{
@ -1480,8 +1480,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}break;
// TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..)
case TARGET_SINGLE_PARTY:
@ -1557,8 +1557,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}break;
case TARGET_DUELVSPLAYER:
{
@ -1607,8 +1607,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}
}break;
case TARGET_MINION:
@ -1726,8 +1726,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap());
}
@ -1791,8 +1791,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier);
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap());
}
}
}break;
@ -1848,8 +1848,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap());
cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap());
}
}
else
@ -3383,7 +3383,7 @@ uint8 Spell::CanCast(bool strict)
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap());
if(p_GameObject)
{
@ -3422,7 +3422,7 @@ uint8 Spell::CanCast(bool strict)
TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap());
if(p_Creature )
{
@ -4449,7 +4449,7 @@ uint8 Spell::CheckItems()
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster));
cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap());
if(!ok)
return (uint8)SPELL_FAILED_REQUIRES_SPELL_FOCUS;

View file

@ -671,8 +671,8 @@ void AreaAura::Update(uint32 diff)
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
cell_lock->Visit(cell_lock, world_unit_searcher, *caster->GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *caster->GetMap());
break;
}
case AREA_AURA_ENEMY:
@ -687,8 +687,8 @@ void AreaAura::Update(uint32 diff)
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster));
cell_lock->Visit(cell_lock, world_unit_searcher, *caster->GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *caster->GetMap());
break;
}
case AREA_AURA_OWNER:

View file

@ -1938,7 +1938,7 @@ void Spell::EffectTeleportUnits(uint32 i)
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0));
else
{
MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation);
m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation);
WorldPacket data;
unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation);
unitTarget->SendMessageToSet(&data, false);
@ -1964,7 +1964,7 @@ void Spell::EffectTeleportUnits(uint32 i)
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0));
else
{
MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation);
m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation);
WorldPacket data;
unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation);
unitTarget->SendMessageToSet(&data, false);
@ -2626,7 +2626,7 @@ void Spell::EffectPersistentAA(uint32 i)
dynObj->SetUInt32Value(GAMEOBJECT_DISPLAYID, 368003);
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x01eeeeee);
m_caster->AddDynObject(dynObj);
MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj);
dynObj->GetMap()->Add(dynObj);
}
void Spell::EffectEnergize(uint32 i)
@ -3467,7 +3467,7 @@ void Spell::EffectAddFarsight(uint32 i)
dynObj->SetUInt32Value(OBJECT_FIELD_TYPE, 65);
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002);
m_caster->AddDynObject(dynObj);
MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj);
dynObj->GetMap()->Add(dynObj);
m_caster->SetUInt64Value(PLAYER_FARSIGHT, dynObj->GetGUID());
}
@ -3664,7 +3664,7 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i)
if(unitTarget->GetTypeId() == TYPEID_PLAYER)
((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, -m_caster->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0));
else
MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)m_caster, fx, fy, fz, -m_caster->GetOrientation());
m_caster->GetMap()->CreatureRelocation((Creature*)m_caster, fx, fy, fz, -m_caster->GetOrientation());
}
void Spell::EffectLearnSkill(uint32 i)
@ -3905,7 +3905,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
// add to world
MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
pet->GetMap()->Add((Creature*)pet);
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
@ -3935,14 +3935,14 @@ void Spell::EffectSummonPet(uint32 i)
if( OldSummon->isDead() )
return;
MapManager::Instance().GetMap(OldSummon->GetMapId(), OldSummon)->Remove((Creature*)OldSummon,false);
OldSummon->GetMap()->Remove((Creature*)OldSummon,false);
OldSummon->SetMapId(m_caster->GetMapId());
float px, py, pz;
m_caster->GetClosePoint(px, py, pz, OldSummon->GetObjectSize());
OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation());
MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->Add((Creature*)OldSummon);
m_caster->GetMap()->Add((Creature*)OldSummon);
if(m_caster->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() )
{
@ -5438,7 +5438,7 @@ void Spell::EffectMomentMove(uint32 i)
if(unitTarget->GetTypeId() == TYPEID_PLAYER)
((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0));
else
MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation());
m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation());
}
}
@ -5548,7 +5548,7 @@ void Spell::EffectCharge(uint32 /*i*/)
m_caster->SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, 1);
if(m_caster->GetTypeId() != TYPEID_PLAYER)
MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation());
// not all charge effects used in negative spells
if ( !IsPositiveSpell(m_spellInfo->Id))
@ -5984,7 +5984,7 @@ void Spell::EffectTransmitted(uint32 effIndex)
linkedGO->SetSpellId(m_spellInfo->Id);
linkedGO->SetOwnerGUID(m_caster->GetGUID() );
MapManager::Instance().GetMap(linkedGO->GetMapId(), linkedGO)->Add(linkedGO);
linkedGO->GetMap()->Add(linkedGO);
}
else
{

View file

@ -158,7 +158,7 @@ void TemporarySummon::Summon(TempSummonType type, uint32 lifetime)
m_timer = lifetime;
m_lifetime = lifetime;
MapManager::Instance().GetMap(GetMapId(), this)->Add((Creature*)this);
GetMap()->Add((Creature*)this);
AIM_Initialize();
}

View file

@ -93,8 +93,8 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
TypeContainerVisitor<MaNGOS::UnitLastSearcher<MaNGOS::NearestAttackableUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(i_totem.GetMapId(), &i_totem));
cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(i_totem.GetMapId(), &i_totem));
cell_lock->Visit(cell_lock, grid_object_checker, *i_totem.GetMap());
cell_lock->Visit(cell_lock, world_object_checker, *i_totem.GetMap());
}
// If have target

View file

@ -105,7 +105,7 @@ void MapManager::LoadTransports()
//If we someday decide to use the grid to track transports, here:
//MapManager::Instance().LoadGrid(mapid,x,y,true);
//MapManager::Instance().GetMap(t->GetMapId())->Add<GameObject>((GameObject *)t);
//t->GetMap()->Add<GameObject>((GameObject *)t);
++count;
} while(result->NextRow());
delete result;
@ -430,11 +430,11 @@ Transport::WayPointMap::iterator Transport::GetNextWayPoint()
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
{
//MapManager::Instance().GetMap(oldMapid)->Remove((GameObject *)this, false);
//GetMap()->Remove((GameObject *)this, false);
SetMapId(newMapid);
//MapManager::Instance().LoadGrid(newMapid,x,y,true);
Relocate(x, y, z);
//MapManager::Instance().GetMap(newMapid)->Add<GameObject>((GameObject *)this);
//GetMap()->Add<GameObject>((GameObject *)this);
for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();)
{

View file

@ -65,7 +65,7 @@ inline float Traveller<Creature>::Speed()
template<>
inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
{
MapManager::Instance().GetMap(i_traveller.GetMapId(), &i_traveller)->CreatureRelocation(&i_traveller, x, y, z, orientation);
i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation);
}
template<>
@ -87,7 +87,7 @@ inline float Traveller<Player>::Speed()
template<>
inline void Traveller<Player>::Relocation(float x, float y, float z, float orientation)
{
MapManager::Instance().GetMap(i_traveller.GetMapId(), &i_traveller)->PlayerRelocation(&i_traveller, x, y, z, orientation);
i_traveller.GetMap()->PlayerRelocation(&i_traveller, x, y, z, orientation);
}
template<>

View file

@ -8740,7 +8740,7 @@ void Unit::SetVisibility(UnitVisibility x)
if(IsInWorld())
{
Map *m = MapManager::Instance().GetMap(GetMapId(), this);
Map *m = GetMap();
if(GetTypeId()==TYPEID_PLAYER)
m->PlayerRelocation((Player*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
@ -10493,8 +10493,8 @@ Unit* Unit::SelectNearbyTarget() const
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap());
cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap());
}
// remove current target

View file

@ -1644,7 +1644,7 @@ void World::ScriptsProcess()
break;
}
((Unit *)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, ((Unit *)source)->GetUnitMovementFlags(), step.script->datalong2 );
MapManager::Instance().GetMap(((Unit *)source)->GetMapId(), ((Unit *)source))->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0);
((Unit *)source)->GetMap()->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0);
break;
case SCRIPT_COMMAND_FLAG_SET:
if(!source)
@ -1770,7 +1770,7 @@ void World::ScriptsProcess()
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(summoner->GetMapId(), summoner));
cell_lock->Visit(cell_lock, object_checker, *summoner->GetMap());
if ( !go )
{
@ -1794,7 +1794,7 @@ void World::ScriptsProcess()
go->SetLootState(GO_READY);
go->SetRespawnTime(time_to_despawn); //despawn object in ? seconds
MapManager::Instance().GetMap(go->GetMapId(), go)->Add(go);
go->GetMap()->Add(go);
break;
}
case SCRIPT_COMMAND_OPEN_DOOR:
@ -1831,7 +1831,7 @@ void World::ScriptsProcess()
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source));
cell_lock->Visit(cell_lock, object_checker, *caster->GetMap());
if ( !door )
{
@ -1887,7 +1887,7 @@ void World::ScriptsProcess()
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source));
cell_lock->Visit(cell_lock, object_checker, *caster->GetMap());
if ( !door )
{

View file

@ -364,7 +364,7 @@ void WorldSession::LogoutPlayer(bool Save)
// the player may not be in the world when logging out
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
if(_player->IsInWorld()) MapManager::Instance().GetMap(_player->GetMapId(), _player)->Remove(_player, false);
if(_player->IsInWorld()) _player->GetMap()->Remove(_player, false);
// RemoveFromWorld does cleanup that requires the player to be in the accessor
ObjectAccessor::Instance().RemoveObject(_player);