[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

@ -886,7 +886,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(!miscvalue1) if(!miscvalue1)
continue; continue;
Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : MapManager::Instance().FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : mapmgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId());
if(!map || !map->IsDungeon()) if(!map || !map->IsDungeon())
continue; continue;

View file

@ -1597,7 +1597,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
} }
// generate a new instance id // generate a new instance id
bg->SetInstanceID(MapManager::Instance().GenerateInstanceId()); // set instance id bg->SetInstanceID(mapmgr.GenerateInstanceId()); // set instance id
bg->SetClientInstanceID(CreateClientVisibleInstanceId(bgTypeId, queue_id)); bg->SetClientInstanceID(CreateClientVisibleInstanceId(bgTypeId, queue_id));
// reset the new bg (set status to status_wait_queue from status_none) // reset the new bg (set status to status_wait_queue from status_none)

View file

@ -699,7 +699,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
} }
ObjectAccessor::Instance().AddObject(pCurrChar); objaccessor.AddObject(pCurrChar);
//sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName());
pCurrChar->SendInitialPacketsAfterAddToMap(); pCurrChar->SendInitialPacketsAfterAddToMap();

View file

@ -50,7 +50,7 @@ void Corpse::AddToWorld()
{ {
///- Register the corpse for guid lookup ///- Register the corpse for guid lookup
if(!IsInWorld()) if(!IsInWorld())
ObjectAccessor::Instance().AddObject(this); objaccessor.AddObject(this);
Object::AddToWorld(); Object::AddToWorld();
} }
@ -59,7 +59,7 @@ void Corpse::RemoveFromWorld()
{ {
///- Remove the corpse from the accessor ///- Remove the corpse from the accessor
if(IsInWorld()) if(IsInWorld())
ObjectAccessor::Instance().RemoveObject(this); objaccessor.RemoveObject(this);
Object::RemoveFromWorld(); Object::RemoveFromWorld();
} }

View file

@ -116,7 +116,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
DEBUG_LOG("update the ticket"); DEBUG_LOG("update the ticket");
//TODO: Guard player map //TODO: Guard player map
HashMapHolder<Player>::MapType &m = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType &m = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) for(HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets()) if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets())

View file

@ -520,7 +520,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
objmgr.AddCreatureToGrid(*itr, data); objmgr.AddCreatureToGrid(*itr, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid)); Map* map = const_cast<Map*>(mapmgr.CreateBaseMap(data->mapid));
// We use spawn coords to spawn // We use spawn coords to spawn
if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY)) if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY))
{ {
@ -553,7 +553,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
objmgr.AddGameobjectToGrid(*itr, data); objmgr.AddGameobjectToGrid(*itr, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed // this base map checked as non-instanced and then only existed
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid)); Map* map = const_cast<Map*>(mapmgr.CreateBaseMap(data->mapid));
// We use current coords to unspawn, not spawn coords since creature can have changed grid // We use current coords to unspawn, not spawn coords since creature can have changed grid
if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{ {

View file

@ -51,7 +51,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones)
/// Resurrectable - convert corpses to bones /// Resurrectable - convert corpses to bones
if(!bones) if(!bones)
{ {
if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid)) if(!objaccessor.ConvertCorpseForPlayer(player_guid))
{ {
sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow); sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow);
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
@ -60,7 +60,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones)
else else
///- or delete bones ///- or delete bones
{ {
MapManager::Instance().RemoveBonesFromMap(mapid, guid, positionX, positionY); mapmgr.RemoveBonesFromMap(mapid, guid, positionX, positionY);
///- remove bones from the database ///- remove bones from the database
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);

View file

@ -1561,7 +1561,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
bool isEmpty = true; bool isEmpty = true;
// if the map is loaded, reset it // 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() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset())) if(map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
isEmpty = ((InstanceMap*)map)->Reset(method); isEmpty = ((InstanceMap*)map)->Reset(method);

View file

@ -168,7 +168,7 @@ void InstanceSave::SaveToDB()
// save instance data too // save instance data too
std::string data; std::string data;
Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid); Map *map = mapmgr.FindMap(GetMapId(),m_instanceid);
if(map) if(map)
{ {
assert(map->IsDungeon()); assert(map->IsDungeon());
@ -567,7 +567,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr)
void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
{ {
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid); Map *map = (MapInstanced*)mapmgr.CreateBaseMap(mapid);
if(!map->Instanceable()) if(!map->Instanceable())
return; return;
@ -584,7 +584,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe
{ {
// global reset for all instances of the given map // global reset for all instances of the given map
// note: this isn't fast but it's meant to be executed very rarely // note: this isn't fast but it's meant to be executed very rarely
Map const *map = MapManager::Instance().CreateBaseMap(mapid); Map const *map = mapmgr.CreateBaseMap(mapid);
if(!map->Instanceable()) if(!map->Instanceable())
return; return;
uint64 now = (uint64)time(NULL); uint64 now = (uint64)time(NULL);

View file

@ -31,7 +31,7 @@ static void AttemptJoin(Player* _player)
return; return;
//TODO: Guard Player Map //TODO: Guard Player Map
HashMapHolder<Player>::MapType const& players = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType const& players = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter)
{ {
Player *plr = iter->second; Player *plr = iter->second;
@ -91,7 +91,7 @@ static void AttemptAddMore(Player* _player)
return; return;
//TODO: Guard Player map //TODO: Guard Player map
HashMapHolder<Player>::MapType const& players = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType const& players = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter)
{ {
Player *plr = iter->second; Player *plr = iter->second;
@ -302,7 +302,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
data << uint32(0); // unk data << uint32(0); // unk
//TODO: Guard Player map //TODO: Guard Player map
HashMapHolder<Player>::MapType const& players = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType const& players = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter) for(HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter)
{ {
Player *plr = iter->second; Player *plr = iter->second;

View file

@ -1967,7 +1967,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args)
//Save all players in the world //Save all players in the world
bool ChatHandler::HandleSaveAllCommand(const char* /*args*/) bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
{ {
ObjectAccessor::Instance().SaveAllPlayers(); objaccessor.SaveAllPlayers();
SendSysMessage(LANG_PLAYERS_SAVED); SendSysMessage(LANG_PLAYERS_SAVED);
return true; return true;
} }
@ -2080,7 +2080,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str()); PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation, Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); mapmgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
} }
return true; return true;
@ -2338,7 +2338,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
else else
_player->SaveRecallPosition(); _player->SaveRecallPosition();
Map const *map = MapManager::Instance().CreateBaseMap(mapid); Map const *map = mapmgr.CreateBaseMap(mapid);
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
@ -2431,7 +2431,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
// update to parent zone if exist (client map show only zones without parents) // update to parent zone if exist (client map show only zones without parents)
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid); Map const *map = mapmgr.CreateBaseMap(zoneEntry->mapid);
if(map->Instanceable()) if(map->Instanceable())
{ {
@ -2506,7 +2506,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
else else
_player->SaveRecallPosition(); _player->SaveRecallPosition();
Map const *map = MapManager::Instance().CreateBaseMap(mapid); Map const *map = mapmgr.CreateBaseMap(mapid);
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation());

View file

@ -192,7 +192,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
{ {
sLog.outString( "Re-Loading config settings..." ); sLog.outString( "Re-Loading config settings..." );
sWorld.LoadConfigSettings(true); sWorld.LoadConfigSettings(true);
MapManager::Instance().InitializeVisibilityDistanceInfo(); mapmgr.InitializeVisibilityDistanceInfo();
SendGlobalSysMessage("World config settings reloaded."); SendGlobalSysMessage("World config settings reloaded.");
return true; return true;
} }
@ -3515,7 +3515,7 @@ bool ChatHandler::HandleReviveCommand(const char* args)
} }
else else
// will resurrected at login without corpse // will resurrected at login without corpse
ObjectAccessor::Instance().ConvertCorpseForPlayer(target_guid); objaccessor.ConvertCorpseForPlayer(target_guid);
return true; return true;
} }
@ -4517,7 +4517,7 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
} }
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin); CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin);
HashMapHolder<Player>::MapType const& plist = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType const& plist = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) for(HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
itr->second->SetAtLoginFlag(atLogin); itr->second->SetAtLoginFlag(atLogin);
@ -6014,8 +6014,8 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args)
bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/) bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
{ {
PSendSysMessage("instances loaded: %d", MapManager::Instance().GetNumInstances()); PSendSysMessage("instances loaded: %d", mapmgr.GetNumInstances());
PSendSysMessage("players in instances: %d", MapManager::Instance().GetNumPlayersInInstances()); PSendSysMessage("players in instances: %d", mapmgr.GetNumPlayersInInstances());
PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves()); PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves());
PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal()); PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal());
PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal()); PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal());

View file

@ -323,7 +323,7 @@ void Map::DeleteFromWorld(T* obj)
template<> template<>
void Map::DeleteFromWorld(Player* pl) void Map::DeleteFromWorld(Player* pl)
{ {
ObjectAccessor::Instance().RemoveObject(pl); objaccessor.RemoveObject(pl);
delete pl; delete pl;
} }
@ -411,7 +411,7 @@ bool Map::EnsureGridLoaded(const Cell &cell)
loader.LoadN(); loader.LoadN();
// Add resurrectable corpses to world object list in grid // Add resurrectable corpses to world object list in grid
ObjectAccessor::Instance().AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this); objaccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this);
setGridObjectDataLoaded(true,cell.GridX(), cell.GridY()); setGridObjectDataLoaded(true,cell.GridX(), cell.GridY());
return true; return true;
@ -2059,7 +2059,7 @@ void Map::SendInitSelf( Player * player )
void Map::SendInitTransports( Player * player ) void Map::SendInitTransports( Player * player )
{ {
// Hack to send out transports // Hack to send out transports
MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap;
// no transports at map // no transports at map
if (tmap.find(player->GetMapId()) == tmap.end()) if (tmap.find(player->GetMapId()) == tmap.end())
@ -2086,7 +2086,7 @@ void Map::SendInitTransports( Player * player )
void Map::SendRemoveTransports( Player * player ) void Map::SendRemoveTransports( Player * player )
{ {
// Hack to send out transports // Hack to send out transports
MapManager::TransportMap& tmap = MapManager::Instance().m_TransportsByMap; MapManager::TransportMap& tmap = mapmgr.m_TransportsByMap;
// no transports at map // no transports at map
if (tmap.find(player->GetMapId()) == tmap.end()) if (tmap.find(player->GetMapId()) == tmap.end())

View file

@ -166,7 +166,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{ {
// if no instanceId via group members or instance saves is found // if no instanceId via group members or instance saves is found
// the instance will be created for the first time // the instance will be created for the first time
NewInstanceId = MapManager::Instance().GenerateInstanceId(); NewInstanceId = mapmgr.GenerateInstanceId();
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
map = CreateInstance(NewInstanceId, NULL, diff); map = CreateInstance(NewInstanceId, NULL, diff);

View file

@ -154,4 +154,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
uint32 i_MaxInstanceId; uint32 i_MaxInstanceId;
}; };
#define mapmgr MapManager::Instance()
#endif #endif

View file

@ -142,7 +142,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
data << clientcount; // clientcount place holder data << clientcount; // clientcount place holder
//TODO: Guard Player map //TODO: Guard Player map
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers(); HashMapHolder<Player>::MapType& m = objaccessor.GetPlayers();
for(HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) for(HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{ {
if (security == SEC_PLAYER) if (security == SEC_PLAYER)

View file

@ -65,7 +65,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetSemaphoreTeleportFar(false); GetPlayer()->SetSemaphoreTeleportFar(false);
// relocate the player to the teleport destination // relocate the player to the teleport destination
GetPlayer()->SetMap(MapManager::Instance().CreateMap(loc.mapid, GetPlayer())); GetPlayer()->SetMap(mapmgr.CreateMap(loc.mapid, GetPlayer()));
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation); GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
GetPlayer()->SendInitialPacketsBeforeAddToMap(); GetPlayer()->SendInitialPacketsBeforeAddToMap();
@ -274,7 +274,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if (plMover && !plMover->m_transport) if (plMover && !plMover->m_transport)
{ {
// elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
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)->GetGUID() == movementInfo.t_guid) if ((*iter)->GetGUID() == movementInfo.t_guid)
{ {

View file

@ -1589,7 +1589,7 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
{ {
//if object is in world, map for it already created! //if object is in world, map for it already created!
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
if(_map) if(_map)
_map->MessageBroadcast(this, data); _map->MessageBroadcast(this, data);
} }
@ -1597,7 +1597,7 @@ void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/) void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
{ {
//if object is in world, map for it already created! //if object is in world, map for it already created!
Map * _map = IsInWorld() ? GetMap() : MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); Map * _map = IsInWorld() ? GetMap() : mapmgr.FindMap(GetMapId(), GetInstanceId());
if(_map) if(_map)
_map->MessageDistBroadcast(this, data, dist); _map->MessageDistBroadcast(this, data, dist);
} }

View file

@ -249,7 +249,7 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
// remove resurrectable corpse from grid object registry (loaded state checked into call) // remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded // do not load the map if it's not loaded
Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId()); Map *map = mapmgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
if(map) if(map)
map->Remove(corpse, false); map->Remove(corpse, false);

View file

@ -168,4 +168,6 @@ inline Unit* ObjectAccessor::GetUnitInWorld(WorldObject const& obj, uint64 guid)
return GetCreatureInWorld(guid); return GetCreatureInWorld(guid);
} }
#define objaccessor ObjectAccessor::Instance()
#endif #endif

View file

@ -147,7 +147,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType
uint32 player_guid = itr->first; uint32 player_guid = itr->first;
Corpse *obj = ObjectAccessor::Instance().GetCorpseForPlayerGUID(player_guid); Corpse *obj = objaccessor.GetCorpseForPlayerGUID(player_guid);
if(!obj) if(!obj)
continue; continue;

View file

@ -5232,7 +5232,7 @@ void ObjectMgr::LoadGraveyardZones()
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
{ {
// search for zone associated closest graveyard // search for zone associated closest graveyard
uint32 zoneId = MapManager::Instance().GetZoneId(MapId,x,y,z); uint32 zoneId = mapmgr.GetZoneId(MapId,x,y,z);
// Simulate std. algorithm: // Simulate std. algorithm:
// found some graveyard associated to (ghost_zone,ghost_map) // found some graveyard associated to (ghost_zone,ghost_map)
@ -6225,7 +6225,7 @@ void ObjectMgr::LoadCorpses()
continue; continue;
} }
ObjectAccessor::Instance().AddCorpse(corpse); objaccessor.AddCorpse(corpse);
++count; ++count;
} }

View file

@ -556,7 +556,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
return false; return false;
} }
SetMap(MapManager::Instance().CreateMap(info->mapId, this)); SetMap(mapmgr.CreateMap(info->mapId, this));
uint8 powertype = cEntry->powerType; 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 // 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 // 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; return false;
// If the map is not created, assume it is possible to enter it. // If the map is not created, assume it is possible to enter it.
// It will be created in the WorldPortAck. // It will be created in the WorldPortAck.
Map *map = MapManager::Instance().FindMap(mapid); Map *map = mapmgr.FindMap(mapid);
if (!map || map->CanEnter(this)) if (!map || map->CanEnter(this))
{ {
//lets reset near teleport flag if it wasn't reset during chained teleports //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) // 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 // bones will be deleted by corpse/bones deleting thread shortly
ObjectAccessor::Instance().ConvertCorpseForPlayer(playerguid); objaccessor.ConvertCorpseForPlayer(playerguid);
// remove from guild // remove from guild
uint32 guildId = GetGuildIdFromDB(playerguid); uint32 guildId = GetGuildIdFromDB(playerguid);
@ -4295,18 +4295,18 @@ void Player::CreateCorpse()
corpse->SaveToDB(); corpse->SaveToDB();
// register for player, but not show // register for player, but not show
ObjectAccessor::Instance().AddCorpse(corpse); objaccessor.AddCorpse(corpse);
} }
void Player::SpawnCorpseBones() void Player::SpawnCorpseBones()
{ {
if(ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID())) if(objaccessor.ConvertCorpseForPlayer(GetGUID()))
SaveToDB(); // prevent loading as ghost without corpse SaveToDB(); // prevent loading as ghost without corpse
} }
Corpse* Player::GetCorpse() const Corpse* Player::GetCorpse() const
{ {
return ObjectAccessor::Instance().GetCorpseForPlayerGUID(GetGUID()); return objaccessor.GetCorpseForPlayerGUID(GetGUID());
} }
void Player::DurabilityLossAll(double percent, bool inventory) void Player::DurabilityLossAll(double percent, bool inventory)
@ -5666,7 +5666,7 @@ void Player::SaveRecallPosition()
void Player::SendMessageToSet(WorldPacket *data, bool self) 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) if(_map)
{ {
_map->MessageBroadcast(this, data, self); _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) 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) if(_map)
{ {
_map->MessageDistBroadcast(this, data, dist, self); _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) 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) if(_map)
{ {
_map->MessageDistBroadcast(this, data, dist, self, own_team_only); _map->MessageDistBroadcast(this, data, dist, self, own_team_only);
@ -6179,7 +6179,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
float posz = fields[3].GetFloat(); float posz = fields[3].GetFloat();
delete result; delete result;
zone = MapManager::Instance().GetZoneId(map,posx,posy,posz); zone = mapmgr.GetZoneId(map,posx,posy,posz);
if (zone > 0) if (zone > 0)
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow); 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 // 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 // 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) if (!bones)
return; return;
@ -12135,7 +12135,7 @@ void Player::PrepareQuestMenu( uint64 guid )
{ {
//we should obtain map pointer from GetMap() in 99% of cases. Special case //we should obtain map pointer from GetMap() in 99% of cases. Special case
//only for quests which cast teleport spells on player //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); ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid); GameObject *pGameObject = _map->GetGameObject(guid);
if( pGameObject ) 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 //we should obtain map pointer from GetMap() in 99% of cases. Special case
//only for quests which cast teleport spells on player //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); ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid); GameObject *pGameObject = _map->GetGameObject(guid);
if( pGameObject ) if( pGameObject )
@ -14293,7 +14293,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
if (transGUID != 0) 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) if( (*iter)->GetGUIDLow() == transGUID)
{ {
@ -14342,7 +14342,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// NOW player must have valid map // NOW player must have valid map
// load the player's map here if it's not already loaded // 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 the player is in an instance and it has been reset in the meantime teleport him to the entrance
if(GetInstanceId() && !sInstanceSaveManager.GetInstanceSave(GetInstanceId())) 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! //we can be relocated from taxi and still have an outdated Map pointer!
//so we need to get a new 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 SaveRecallPosition(); // save as recall also to prevent recall and fall from sky
m_taxi.ClearTaxiDestinations(); m_taxi.ClearTaxiDestinations();
@ -14808,7 +14808,7 @@ void Player::LoadCorpse()
{ {
if( isAlive() ) if( isAlive() )
{ {
ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()); objaccessor.ConvertCorpseForPlayer(GetGUID());
} }
else else
{ {
@ -16246,7 +16246,7 @@ void Player::ResetInstances(uint8 method, bool isRaid)
} }
// if the map is loaded, reset it // 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()) if(map && map->IsDungeon())
((InstanceMap*)map)->Reset(method); ((InstanceMap*)map)->Reset(method);

View file

@ -248,7 +248,7 @@ bool PoolGroup<Creature>::Spawn1Object(uint32 guid)
objmgr.AddCreatureToGrid(guid, data); objmgr.AddCreatureToGrid(guid, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid)); Map* map = const_cast<Map*>(mapmgr.CreateBaseMap(data->mapid));
// We use spawn coords to spawn // We use spawn coords to spawn
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{ {
@ -276,7 +276,7 @@ bool PoolGroup<GameObject>::Spawn1Object(uint32 guid)
objmgr.AddGameobjectToGrid(guid, data); objmgr.AddGameobjectToGrid(guid, data);
// Spawn if necessary (loaded grids only) // Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed // this base map checked as non-instanced and then only existed
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid)); Map* map = const_cast<Map*>(mapmgr.CreateBaseMap(data->mapid));
// We use current coords to unspawn, not spawn coords since creature can have changed grid // We use current coords to unspawn, not spawn coords since creature can have changed grid
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{ {

View file

@ -299,7 +299,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) if(corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
{ {
// if corpse map have entrance // if corpse map have entrance
if(Map const* entranceMap = MapManager::Instance().CreateBaseMap(corpseMapEntry->entrance_map)) if(Map const* entranceMap = mapmgr.CreateBaseMap(corpseMapEntry->entrance_map))
{ {
mapid = corpseMapEntry->entrance_map; mapid = corpseMapEntry->entrance_map;
x = corpseMapEntry->entrance_x; x = corpseMapEntry->entrance_x;

View file

@ -102,7 +102,7 @@ void MapManager::LoadTransports()
m_TransportsByMap[*i].insert(t); m_TransportsByMap[*i].insert(t);
//If we someday decide to use the grid to track transports, here: //If we someday decide to use the grid to track transports, here:
t->SetMap(MapManager::Instance().CreateMap(mapid, t)); t->SetMap(mapmgr.CreateMap(mapid, t));
//t->GetMap()->Add<GameObject>((GameObject *)t); //t->GetMap()->Add<GameObject>((GameObject *)t);
++count; ++count;
@ -459,7 +459,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
//we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference...
//player far teleport would try to create same instance, but we need it NOW for transport... //player far teleport would try to create same instance, but we need it NOW for transport...
//correct me if I'm wrong O.o //correct me if I'm wrong O.o
Map * newMap = MapManager::Instance().CreateMap(newMapid, this); Map * newMap = mapmgr.CreateMap(newMapid, this);
SetMap(newMap); SetMap(newMap);
if(oldMap != newMap) if(oldMap != newMap)

View file

@ -569,7 +569,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; m_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
} }
if(reload) if(reload)
MapManager::Instance().SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]); mapmgr.SetGridCleanUpDelay(m_configs[CONFIG_INTERVAL_GRIDCLEAN]);
m_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfig.GetIntDefault("MapUpdateInterval", 100); m_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfig.GetIntDefault("MapUpdateInterval", 100);
if(m_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) if(m_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
@ -578,7 +578,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; m_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY;
} }
if(reload) if(reload)
MapManager::Instance().SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]); mapmgr.SetMapUpdateInterval(m_configs[CONFIG_INTERVAL_MAPUPDATE]);
m_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfig.GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILISECONDS); m_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfig.GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILISECONDS);
@ -1489,7 +1489,7 @@ void World::SetInitialWorldSettings()
///- Initialize MapManager ///- Initialize MapManager
sLog.outString( "Starting Map System" ); sLog.outString( "Starting Map System" );
MapManager::Instance().Initialize(); mapmgr.Initialize();
///- Initialize Battlegrounds ///- Initialize Battlegrounds
sLog.outString( "Starting BattleGround System" ); sLog.outString( "Starting BattleGround System" );
@ -1498,7 +1498,7 @@ void World::SetInitialWorldSettings()
//Not sure if this can be moved up in the sequence (with static data loading) as it uses MapManager //Not sure if this can be moved up in the sequence (with static data loading) as it uses MapManager
sLog.outString( "Loading Transports..." ); sLog.outString( "Loading Transports..." );
MapManager::Instance().LoadTransports(); mapmgr.LoadTransports();
sLog.outString("Deleting expired bans..." ); sLog.outString("Deleting expired bans..." );
loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
@ -1643,7 +1643,7 @@ void World::Update(uint32 diff)
{ {
m_timers[WUPDATE_OBJECTS].Reset(); m_timers[WUPDATE_OBJECTS].Reset();
///- Update objects when the timer has passed (maps, transport, creatures,...) ///- Update objects when the timer has passed (maps, transport, creatures,...)
MapManager::Instance().Update(diff); // As interval = 0 mapmgr.Update(diff); // As interval = 0
sBattleGroundMgr.Update(diff); sBattleGroundMgr.Update(diff);
} }
@ -1670,7 +1670,7 @@ void World::Update(uint32 diff)
/// </ul> /// </ul>
///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
MapManager::Instance().DoDelayedMovesAndRemoves(); mapmgr.DoDelayedMovesAndRemoves();
// update the instance reset times // update the instance reset times
sInstanceSaveManager.Update(); sInstanceSaveManager.Update();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8784" #define REVISION_NR "8785"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__