feat(Core/Misc): remove and replace ACE_Singleton (#2418)

This commit is contained in:
Kargatum
2019-12-21 00:29:29 +07:00
committed by GitHub
parent 16b45bf334
commit 4a8f1de538
88 changed files with 486 additions and 250 deletions

View File

@@ -20,6 +20,12 @@
#include "SmartScriptMgr.h"
SmartWaypointMgr* SmartWaypointMgr::instance()
{
static SmartWaypointMgr instance;
return &instance;
}
void SmartWaypointMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
@@ -92,6 +98,12 @@ SmartWaypointMgr::~SmartWaypointMgr()
}
}
SmartAIMgr* SmartAIMgr::instance()
{
static SmartAIMgr instance;
return &instance;
}
void SmartAIMgr::LoadSmartAIFromDB()
{
uint32 oldMSTime = getMSTime();

View File

@@ -1569,6 +1569,7 @@ typedef std::unordered_map<uint32, WayPoint*> WPPath;
typedef std::list<WorldObject*> ObjectList;
typedef std::list<uint64> GuidList;
class ObjectGuidList
{
ObjectList* m_objectList;
@@ -1619,15 +1620,17 @@ public:
delete m_guidList;
}
};
typedef std::unordered_map<uint32, ObjectGuidList*> ObjectListMap;
class SmartWaypointMgr
{
friend class ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>;
SmartWaypointMgr() {}
public:
~SmartWaypointMgr();
static SmartWaypointMgr* instance();
void LoadFromDB();
WPPath* GetPath(uint32 id)
@@ -1650,11 +1653,12 @@ typedef std::unordered_map<int32, SmartAIEventList> SmartAIEventMap;
class SmartAIMgr
{
friend class ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>;
SmartAIMgr(){};
public:
~SmartAIMgr(){};
static SmartAIMgr* instance();
void LoadSmartAIFromDB();
SmartAIEventList GetScript(int32 entry, SmartScriptType type)
@@ -1812,6 +1816,7 @@ class SmartAIMgr
//bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
#define sSmartWaypointMgr ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>::instance()
#define sSmartScriptMgr SmartAIMgr::instance()
#define sSmartWaypointMgr SmartWaypointMgr::instance()
#endif