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:
@@ -17,21 +17,18 @@
|
||||
*/
|
||||
|
||||
#include "ChannelMgr.h"
|
||||
#include "SingletonImp.h"
|
||||
#include "World.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(AllianceChannelMgr);
|
||||
INSTANTIATE_SINGLETON_1(HordeChannelMgr);
|
||||
#include "World.h"
|
||||
|
||||
ChannelMgr* channelMgr(uint32 team)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
return &Trinity::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
|
||||
|
||||
if (team == ALLIANCE)
|
||||
return &Trinity::Singleton<AllianceChannelMgr>::Instance();
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
|
||||
if (team == HORDE)
|
||||
return &Trinity::Singleton<HordeChannelMgr>::Instance();
|
||||
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Channel.h"
|
||||
#include "Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -165,8 +165,8 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType &m = ObjectAccessor::Instance().GetPlayers();
|
||||
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
|
||||
HashMapHolder<Player>::MapType &m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
|
||||
|
||||
@@ -2381,7 +2381,7 @@ bool ChatHandler::HandleWhispersCommand(const char* args)
|
||||
//Save all players in the world
|
||||
bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
|
||||
{
|
||||
ObjectAccessor::Instance().SaveAllPlayers();
|
||||
sObjectAccessor.SaveAllPlayers();
|
||||
SendSysMessage(LANG_PLAYERS_SAVED);
|
||||
return true;
|
||||
}
|
||||
@@ -2502,7 +2502,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
|
||||
|
||||
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetTrinityString(LANG_OFFLINE), tele->name.c_str());
|
||||
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);
|
||||
sMapMgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2768,7 +2768,7 @@ bool ChatHandler::HandleGoXYCommand(const char* args)
|
||||
else
|
||||
_player->SaveRecallPosition();
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid);
|
||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||
|
||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||
@@ -2861,7 +2861,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
|
||||
// update to parent zone if exist (client map show only zones without parents)
|
||||
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(zoneEntry->mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(zoneEntry->mapid);
|
||||
|
||||
if (map->Instanceable())
|
||||
{
|
||||
@@ -2936,7 +2936,7 @@ bool ChatHandler::HandleGoGridCommand(const char* args)
|
||||
else
|
||||
_player->SaveRecallPosition();
|
||||
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(mapid);
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid);
|
||||
float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y));
|
||||
_player->TeleportTo(mapid, x, y, z, _player->GetOrientation());
|
||||
|
||||
|
||||
@@ -2844,7 +2844,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);
|
||||
//sMapMgr.GetMap(npcCreature->GetMapId())->Add(wpCreature2);
|
||||
}
|
||||
|
||||
WorldDatabase.PExecuteLog("UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'",
|
||||
|
||||
@@ -689,7 +689,7 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
|
||||
{
|
||||
sLog.outString("Re-Loading config settings...");
|
||||
sWorld.LoadConfigSettings(true);
|
||||
MapManager::Instance().InitializeVisibilityDistanceInfo();
|
||||
sMapMgr.InitializeVisibilityDistanceInfo();
|
||||
SendGlobalGMSysMessage("World config settings reloaded.");
|
||||
return true;
|
||||
}
|
||||
@@ -4513,7 +4513,7 @@ bool ChatHandler::HandleReviveCommand(const char *args)
|
||||
}
|
||||
else
|
||||
// will resurrected at login without corpse
|
||||
ObjectAccessor::Instance().ConvertCorpseForPlayer(target_guid);
|
||||
sObjectAccessor.ConvertCorpseForPlayer(target_guid);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -5533,8 +5533,8 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin);
|
||||
|
||||
ObjectAccessor::Guard guard(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& plist = ObjectAccessor::Instance().GetPlayers();
|
||||
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder<Player>::GetLock(), true);
|
||||
HashMapHolder<Player>::MapType const& plist = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
|
||||
itr->second->SetAtLoginFlag(atLogin);
|
||||
|
||||
@@ -7020,8 +7020,8 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
|
||||
{
|
||||
PSendSysMessage("instances loaded: %d", MapManager::Instance().GetNumInstances());
|
||||
PSendSysMessage("players in instances: %d", MapManager::Instance().GetNumPlayersInInstances());
|
||||
PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances());
|
||||
PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances());
|
||||
PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves());
|
||||
PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal());
|
||||
PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal());
|
||||
|
||||
Reference in New Issue
Block a user