[8785] Use macro instead of explicit call to singleton Instance().

* For: ObjectAccessor, MapManager.
This commit is contained in:
XTZGZoReX 2009-11-08 03:45:26 +01:00
parent 6abf7e7f58
commit dc725ad6b8
28 changed files with 77 additions and 72 deletions

View file

@ -556,7 +556,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
return false;
}
SetMap(MapManager::Instance().CreateMap(info->mapId, this));
SetMap(mapmgr.CreateMap(info->mapId, this));
uint8 powertype = cEntry->powerType;
@ -1680,12 +1680,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// Check enter rights before map getting to avoid creating instance copy for player
// this check not dependent from map instance copy and same for all instance copies of selected map
if (!MapManager::Instance().CanPlayerEnter(mapid, this))
if (!mapmgr.CanPlayerEnter(mapid, this))
return false;
// If the map is not created, assume it is possible to enter it.
// It will be created in the WorldPortAck.
Map *map = MapManager::Instance().FindMap(mapid);
Map *map = mapmgr.FindMap(mapid);
if (!map || map->CanEnter(this))
{
//lets reset near teleport flag if it wasn't reset during chained teleports
@ -3887,7 +3887,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
// convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry)
// bones will be deleted by corpse/bones deleting thread shortly
ObjectAccessor::Instance().ConvertCorpseForPlayer(playerguid);
objaccessor.ConvertCorpseForPlayer(playerguid);
// remove from guild
uint32 guildId = GetGuildIdFromDB(playerguid);
@ -4295,18 +4295,18 @@ void Player::CreateCorpse()
corpse->SaveToDB();
// register for player, but not show
ObjectAccessor::Instance().AddCorpse(corpse);
objaccessor.AddCorpse(corpse);
}
void Player::SpawnCorpseBones()
{
if(ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()))
if(objaccessor.ConvertCorpseForPlayer(GetGUID()))
SaveToDB(); // prevent loading as ghost without corpse
}
Corpse* Player::GetCorpse() const
{
return ObjectAccessor::Instance().GetCorpseForPlayerGUID(GetGUID());
return objaccessor.GetCorpseForPlayerGUID(GetGUID());
}
void Player::DurabilityLossAll(double percent, bool inventory)
@ -5666,7 +5666,7 @@ void Player::SaveRecallPosition()
void Player::SendMessageToSet(WorldPacket *data, bool self)
{
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
if(_map)
{
_map->MessageBroadcast(this, data, self);
@ -5681,7 +5681,7 @@ void Player::SendMessageToSet(WorldPacket *data, bool self)
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
{
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
if(_map)
{
_map->MessageDistBroadcast(this, data, dist, self);
@ -5694,7 +5694,7 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only)
{
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
if(_map)
{
_map->MessageDistBroadcast(this, data, dist, self, own_team_only);
@ -6179,7 +6179,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
float posz = fields[3].GetFloat();
delete result;
zone = MapManager::Instance().GetZoneId(map,posx,posy,posz);
zone = mapmgr.GetZoneId(map,posx,posy,posz);
if (zone > 0)
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
@ -7347,7 +7347,7 @@ void Player::RemovedInsignia(Player* looterPlr)
// We have to convert player corpse to bones, not to be able to resurrect there
// SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
Corpse *bones = ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID(),true);
Corpse *bones = objaccessor.ConvertCorpseForPlayer(GetGUID(),true);
if (!bones)
return;
@ -12135,7 +12135,7 @@ void Player::PrepareQuestMenu( uint64 guid )
{
//we should obtain map pointer from GetMap() in 99% of cases. Special case
//only for quests which cast teleport spells on player
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
if( pGameObject )
@ -12292,7 +12292,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
{
//we should obtain map pointer from GetMap() in 99% of cases. Special case
//only for quests which cast teleport spells on player
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
if( pGameObject )
@ -14293,7 +14293,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
if (transGUID != 0)
{
for (MapManager::TransportSet::const_iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
for (MapManager::TransportSet::const_iterator iter = mapmgr.m_Transports.begin(); iter != mapmgr.m_Transports.end(); ++iter)
{
if( (*iter)->GetGUIDLow() == transGUID)
{
@ -14342,7 +14342,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// NOW player must have valid map
// load the player's map here if it's not already loaded
SetMap(MapManager::Instance().CreateMap(GetMapId(), this));
SetMap(mapmgr.CreateMap(GetMapId(), this));
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId()))
@ -14536,7 +14536,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
//we can be relocated from taxi and still have an outdated Map pointer!
//so we need to get a new Map pointer!
SetMap(MapManager::Instance().CreateMap(GetMapId(), this));
SetMap(mapmgr.CreateMap(GetMapId(), this));
SaveRecallPosition(); // save as recall also to prevent recall and fall from sky
m_taxi.ClearTaxiDestinations();
@ -14808,7 +14808,7 @@ void Player::LoadCorpse()
{
if( isAlive() )
{
ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID());
objaccessor.ConvertCorpseForPlayer(GetGUID());
}
else
{
@ -16246,7 +16246,7 @@ void Player::ResetInstances(uint8 method, bool isRaid)
}
// if the map is loaded, reset it
Map *map = MapManager::Instance().FindMap(p->GetMapId(), p->GetInstanceId());
Map *map = mapmgr.FindMap(p->GetMapId(), p->GetInstanceId());
if(map && map->IsDungeon())
((InstanceMap*)map)->Reset(method);