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:
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SQLStorage.h"
|
||||
|
||||
#include "Player.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Log.h"
|
||||
@@ -40,14 +39,7 @@
|
||||
#include "Group.h"
|
||||
#include "InstanceData.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Singleton.h"
|
||||
#include "SingletonImp.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(InstanceSaveManager);
|
||||
|
||||
InstanceSaveManager::InstanceSaveManager() : lock_instLists(false)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceSaveManager::~InstanceSaveManager()
|
||||
{
|
||||
@@ -173,7 +165,7 @@ void InstanceSave::SaveToDB()
|
||||
// save instance data too
|
||||
std::string data;
|
||||
|
||||
Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid);
|
||||
Map *map = sMapMgr.FindMap(GetMapId(),m_instanceid);
|
||||
if (map)
|
||||
{
|
||||
assert(map->IsDungeon());
|
||||
@@ -615,7 +607,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr)
|
||||
void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
||||
{
|
||||
sLog.outDebug("InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId);
|
||||
Map *map = (MapInstanced*)MapManager::Instance().CreateBaseMap(mapid);
|
||||
Map *map = (MapInstanced*)sMapMgr.CreateBaseMap(mapid);
|
||||
if (!map->Instanceable())
|
||||
return;
|
||||
|
||||
@@ -679,7 +671,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
||||
}
|
||||
|
||||
// note: this isn't fast but it's meant to be executed very rarely
|
||||
Map const *map = MapManager::Instance().CreateBaseMap(mapid); // _not_ include difficulty
|
||||
Map const *map = sMapMgr.CreateBaseMap(mapid); // _not_ include difficulty
|
||||
MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps();
|
||||
MapInstanced::InstancedMaps::iterator mitr;
|
||||
for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define __InstanceSaveMgr_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
#include "ace/Thread_Mutex.h"
|
||||
#include <list>
|
||||
#include <map>
|
||||
@@ -117,13 +117,14 @@ class InstanceSave
|
||||
|
||||
typedef UNORDERED_MAP<uint32 /*PAIR32(map,difficulty)*/,time_t /*resetTime*/> ResetTimeByMapDifficultyMap;
|
||||
|
||||
class InstanceSaveManager : public Trinity::Singleton<InstanceSaveManager, Trinity::ClassLevelLockable<InstanceSaveManager, ACE_Thread_Mutex> >
|
||||
class InstanceSaveManager
|
||||
{
|
||||
friend class ACE_Singleton<InstanceSaveManager, ACE_Null_Mutex>;
|
||||
friend class InstanceSave;
|
||||
public:
|
||||
InstanceSaveManager();
|
||||
InstanceSaveManager() : lock_instLists(false) {};
|
||||
~InstanceSaveManager();
|
||||
|
||||
|
||||
typedef UNORDERED_MAP<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveHashMap;
|
||||
typedef UNORDERED_MAP<uint32 /*mapId*/, InstanceSaveHashMap> InstanceSaveMapMap;
|
||||
|
||||
@@ -176,6 +177,7 @@ class InstanceSaveManager : public Trinity::Singleton<InstanceSaveManager, Trini
|
||||
uint32 GetNumBoundGroupsTotal();
|
||||
|
||||
private:
|
||||
|
||||
void _ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, uint32 timeleft);
|
||||
void _ResetInstance(uint32 mapid, uint32 instanceId);
|
||||
void _ResetSave(InstanceSaveHashMap::iterator &itr);
|
||||
@@ -189,5 +191,5 @@ class InstanceSaveManager : public Trinity::Singleton<InstanceSaveManager, Trini
|
||||
ResetTimeQueue m_resetTimeQueue;
|
||||
};
|
||||
|
||||
#define sInstanceSaveManager Trinity::Singleton<InstanceSaveManager>::Instance()
|
||||
#define sInstanceSaveManager (*ACE_Singleton<InstanceSaveManager, ACE_Thread_Mutex>::instance())
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user