Get rid of Trinity Singleton and Threading patterns and replace them with ACE_Singletons and ACE_GUARD_x macro´s with ACE_Thread_Mutex´es respectively.

Also get rid of unused CountedReference class that used Trinity threading pattern.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-06-25 00:18:01 +02:00
parent a6b9e716a6
commit 0f7657b68c
109 changed files with 349 additions and 1221 deletions
+18 -18
View File
@@ -587,7 +587,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
return false;
}
SetMap(MapManager::Instance().CreateMap(info->mapId, this, 0));
SetMap(sMapMgr.CreateMap(info->mapId, this, 0));
uint8 powertype = cEntry->powerType;
@@ -1822,12 +1822,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, false))
if (!sMapMgr.CanPlayerEnter(mapid, this, false))
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 = sMapMgr.FindMap(mapid);
if (!map || map->CanEnter(this))
{
//lets reset near teleport flag if it wasn't reset during chained teleports
@@ -4255,7 +4255,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);
sObjectAccessor.ConvertCorpseForPlayer(playerguid);
// remove from guild
uint32 guildId = GetGuildIdFromDB(playerguid);
@@ -4684,19 +4684,19 @@ void Player::CreateCorpse()
corpse->SaveToDB();
// register for player, but not show
ObjectAccessor::Instance().AddCorpse(corpse);
sObjectAccessor.AddCorpse(corpse);
}
void Player::SpawnCorpseBones()
{
if (ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()))
if (sObjectAccessor.ConvertCorpseForPlayer(GetGUID()))
if (!GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
SaveToDB(); // prevent loading as ghost without corpse
}
Corpse* Player::GetCorpse() const
{
return ObjectAccessor::Instance().GetCorpseForPlayerGUID(GetGUID());
return sObjectAccessor.GetCorpseForPlayerGUID(GetGUID());
}
void Player::DurabilityLossAll(double percent, bool inventory)
@@ -6758,7 +6758,7 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
float posy = fields[2].GetFloat();
float posz = fields[3].GetFloat();
zone = MapManager::Instance().GetZoneId(map,posx,posy,posz);
zone = sMapMgr.GetZoneId(map,posx,posy,posz);
if (zone > 0)
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
@@ -8013,7 +8013,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 = sObjectAccessor.ConvertCorpseForPlayer(GetGUID(),true);
if (!bones)
return;
@@ -13680,7 +13680,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() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
if (pGameObject)
@@ -13855,7 +13855,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() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
ASSERT(_map);
GameObject *pGameObject = _map->GetGameObject(guid);
if (pGameObject)
@@ -15955,7 +15955,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
}
else
{
for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
for (MapManager::TransportSet::iterator iter = sMapMgr.m_Transports.begin(); iter != sMapMgr.m_Transports.end(); ++iter)
{
if ((*iter)->GetGUIDLow() == transGUID)
{
@@ -16038,7 +16038,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
Map *map = MapManager::Instance().CreateMap(mapId, this, instanceId);
Map *map = sMapMgr.CreateMap(mapId, this, instanceId);
if (!map)
{
@@ -16056,14 +16056,14 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
RelocateToHomebind();
}
map = MapManager::Instance().CreateMap(mapId, this, 0);
map = sMapMgr.CreateMap(mapId, this, 0);
if (!map)
{
PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
Relocate(info->positionX,info->positionY,info->positionZ,0.0f);
sLog.outError("ERROR: Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.",guid,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
map = MapManager::Instance().CreateMap(mapId, this, 0);
map = sMapMgr.CreateMap(mapId, this, 0);
if (!map)
{
sLog.outError("ERROR: Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created",guid,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
@@ -16532,7 +16532,7 @@ void Player::_LoadGlyphAuras()
void Player::LoadCorpse()
{
if (isAlive())
ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID());
sObjectAccessor.ConvertCorpseForPlayer(GetGUID());
else
{
if (Corpse *corpse = GetCorpse())
@@ -17446,7 +17446,7 @@ bool Player::CheckInstanceLoginValid()
}
// do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player
return MapManager::Instance().CanPlayerEnter(GetMap()->GetId(), this, true);
return sMapMgr.CanPlayerEnter(GetMap()->GetId(), this, true);
}
bool Player::_LoadHomeBind(QueryResult_AutoPtr result)
@@ -18285,7 +18285,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 = sMapMgr.FindMap(p->GetMapId(), p->GetInstanceId());
if (map && map->IsDungeon())
if (!((InstanceMap*)map)->Reset(method))
{