Core: Get rid of dirty operator workaround for ACE_Singleton class implementation

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-22 21:25:23 +01:00
parent 0948fc5bbe
commit 0f3b9019a8
159 changed files with 1943 additions and 1939 deletions
+17 -17
View File
@@ -39,7 +39,7 @@ GridState* si_GridStates[MAX_GRID_STATE];
Map::~Map()
{
sScriptMgr.OnDestroyMap(this);
sScriptMgr->OnDestroyMap(this);
UnloadAll();
@@ -143,7 +143,7 @@ void Map::LoadMap(int gx,int gy, bool reload)
if (GridMaps[gx][gy])
{
sLog.outDetail("Unloading previously loaded map %u before reloading.",GetId());
sScriptMgr.OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy);
sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy);
delete (GridMaps[gx][gy]);
GridMaps[gx][gy]=NULL;
@@ -163,7 +163,7 @@ void Map::LoadMap(int gx,int gy, bool reload)
}
delete [] tmp;
sScriptMgr.OnLoadGridMap(this, GridMaps[gx][gy], gx, gy);
sScriptMgr->OnLoadGridMap(this, GridMaps[gx][gy], gx, gy);
}
void Map::LoadMapAndVMap(int gx,int gy)
@@ -209,7 +209,7 @@ m_activeNonPlayersIter(m_activeNonPlayers.end()), i_gridExpiry(expiry), i_script
//lets initialize visibility distance for map
Map::InitVisibilityDistance();
sScriptMgr.OnCreateMap(this);
sScriptMgr->OnCreateMap(this);
}
void Map::InitVisibilityDistance()
@@ -418,7 +418,7 @@ bool Map::Add(Player *player)
player->m_clientGUIDs.clear();
player->UpdateObjectVisibility(false);
sScriptMgr.OnPlayerEnterMap(this, player);
sScriptMgr->OnPlayerEnterMap(this, player);
return true;
}
@@ -565,7 +565,7 @@ void Map::Update(const uint32 &t_diff)
if (!m_mapRefManager.isEmpty() || !m_activeNonPlayers.empty())
ProcessRelocationNotifies(t_diff);
sScriptMgr.OnMapUpdate(this, t_diff);
sScriptMgr->OnMapUpdate(this, t_diff);
}
struct ResetNotifier
@@ -684,7 +684,7 @@ void Map::Remove(Player *player, bool remove)
if (remove)
DeleteFromWorld(player);
sScriptMgr.OnPlayerLeaveMap(this, player);
sScriptMgr->OnPlayerLeaveMap(this, player);
}
template<class T>
@@ -1909,7 +1909,7 @@ void Map::SendInitSelf(Player * player)
void Map::SendInitTransports(Player * player)
{
// Hack to send out transports
MapManager::TransportMap& tmap = sMapMgr.m_TransportsByMap;
MapManager::TransportMap& tmap = sMapMgr->m_TransportsByMap;
// no transports at map
if (tmap.find(player->GetMapId()) == tmap.end())
@@ -1936,7 +1936,7 @@ void Map::SendInitTransports(Player * player)
void Map::SendRemoveTransports(Player * player)
{
// Hack to send out transports
MapManager::TransportMap& tmap = sMapMgr.m_TransportsByMap;
MapManager::TransportMap& tmap = sMapMgr->m_TransportsByMap;
// no transports at map
if (tmap.find(player->GetMapId()) == tmap.end())
@@ -2284,11 +2284,11 @@ bool InstanceMap::Add(Player *player)
if (IsDungeon())
{
// get or create an instance save for the map
InstanceSave *mapSave = sInstanceSaveMgr.GetInstanceSave(GetInstanceId());
InstanceSave *mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!mapSave)
{
sLog.outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
mapSave = sInstanceSaveMgr.AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
}
// check for existing instance binds
@@ -2406,7 +2406,7 @@ void InstanceMap::CreateInstanceData(bool load)
if (mInstance)
{
i_script_id = mInstance->script_id;
i_data = sScriptMgr.CreateInstanceData(this);
i_data = sScriptMgr->CreateInstanceData(this);
}
if (!i_data)
@@ -2424,7 +2424,7 @@ void InstanceMap::CreateInstanceData(bool load)
std::string data = fields[0].GetString();
if (data != "")
{
sLog.outDebug("Loading instance data for `%s` with id %u", sObjectMgr.GetScriptName(i_script_id), i_InstanceId);
sLog.outDebug("Loading instance data for `%s` with id %u", sObjectMgr->GetScriptName(i_script_id), i_InstanceId);
i_data->Load(data.c_str());
}
}
@@ -2475,7 +2475,7 @@ void InstanceMap::PermBindAllPlayers(Player *player)
if (!IsDungeon())
return;
InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId());
InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!save)
{
sLog.outError("Cannot bind players, no instance save available for map!");
@@ -2509,7 +2509,7 @@ void InstanceMap::UnloadAll()
ASSERT(!HavePlayers());
if (m_resetAfterUnload == true)
sObjectMgr.DeleteRespawnTimeForInstance(GetInstanceId());
sObjectMgr->DeleteRespawnTimeForInstance(GetInstanceId());
Map::UnloadAll();
}
@@ -2527,9 +2527,9 @@ void InstanceMap::SetResetSchedule(bool on)
// it is assumed that the reset time will rarely (if ever) change while the reset is scheduled
if (IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon())
{
InstanceSave *save = sInstanceSaveMgr.GetInstanceSave(GetInstanceId());
InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!save) sLog.outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, no save available for instance %d of %d", on ? "on" : "off", GetInstanceId(), GetId());
else sInstanceSaveMgr.ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
else sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
}
}
+1 -1
View File
@@ -157,7 +157,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{
// if no instanceId via group members or instance saves is found
// the instance will be created for the first time
NewInstanceId = sMapMgr.GenerateInstanceId();
NewInstanceId = sMapMgr->GenerateInstanceId();
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid());
map = CreateInstance(NewInstanceId, NULL, diff);
+2 -2
View File
@@ -236,7 +236,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
{
InstanceGroupBind* boundedInstance = pGroup->GetBoundInstance(entry);
if (boundedInstance && boundedInstance->save)
if (Map *boundedMap = sMapMgr.FindMap(mapid,boundedInstance->save->GetInstanceId()))
if (Map *boundedMap = sMapMgr->FindMap(mapid,boundedInstance->save->GetInstanceId()))
if (!loginCheck && !boundedMap->CanEnter(player))
return false;
/*
@@ -252,7 +252,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
}
//Other requirements
return player->Satisfy(sObjectMgr.GetAccessRequirement(mapid, targetDifficulty), mapid, true);
return player->Satisfy(sObjectMgr->GetAccessRequirement(mapid, targetDifficulty), mapid, true);
}
void MapManager::Update(uint32 diff)
+1 -1
View File
@@ -168,5 +168,5 @@ class MapManager
uint32 i_MaxInstanceId;
MapUpdater m_updater;
};
#define sMapMgr (*ACE_Singleton<MapManager, ACE_Thread_Mutex>::instance())
#define sMapMgr ACE_Singleton<MapManager, ACE_Thread_Mutex>::instance()
#endif