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

View File

@@ -20,7 +20,6 @@
#include "MapManager.h"
#include "InstanceSaveMgr.h"
#include "SingletonImp.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectAccessor.h"
@@ -37,10 +36,6 @@
#include "Language.h"
#include "WorldPacket.h"
#define CLASS_LOCK Trinity::ClassLevelLockable<MapManager, ACE_Thread_Mutex>
INSTANTIATE_SINGLETON_2(MapManager, CLASS_LOCK);
INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Thread_Mutex);
extern GridState* si_GridStates[]; // debugging code, should be deleted some day
MapManager::MapManager()
@@ -116,7 +111,7 @@ Map* MapManager::_createBaseMap(uint32 id)
if (m == NULL)
{
Guard guard(*this);
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
const MapEntry* entry = sMapStore.LookupEntry(id);
if (entry && entry->Instanceable())
@@ -236,7 +231,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
InstanceGroupBind* boundedInstance = pGroup->GetBoundInstance(player);
if (boundedInstance && boundedInstance->save)
{
if (Map *boundedMap = MapManager::Instance().FindMap(mapid,boundedInstance->save->GetInstanceId()))
if (Map *boundedMap = sMapMgr.FindMap(mapid,boundedInstance->save->GetInstanceId()))
{
// Player permanently bounded to different instance than groups one
InstancePlayerBind* playerBoundedInstance = player->GetBoundInstance(mapid, player->GetDungeonDifficulty());
@@ -307,7 +302,7 @@ void MapManager::Update(uint32 diff)
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
iter->second->DelayedUpdate(i_timer.GetCurrent());
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
sObjectAccessor.Update(i_timer.GetCurrent());
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
(*iter)->Update(i_timer.GetCurrent());
@@ -361,7 +356,7 @@ void MapManager::InitMaxInstanceId()
uint32 MapManager::GetNumInstances()
{
Guard guard(*this);
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
@@ -378,7 +373,7 @@ uint32 MapManager::GetNumInstances()
uint32 MapManager::GetNumPlayersInInstances()
{
Guard guard(*this);
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)