mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
feat(Core/Misc): remove and replace ACE_Singleton (#2418)
This commit is contained in:
@@ -172,6 +172,12 @@ ScriptMgr::~ScriptMgr()
|
||||
{
|
||||
}
|
||||
|
||||
ScriptMgr* ScriptMgr::instance()
|
||||
{
|
||||
static ScriptMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void ScriptMgr::Initialize()
|
||||
{
|
||||
AddScripts();
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
#define SC_SCRIPTMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <atomic>
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "DBCStores.h"
|
||||
#include "QuestDef.h"
|
||||
@@ -21,6 +18,7 @@
|
||||
#include "DynamicObject.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include <atomic>
|
||||
|
||||
class AuctionHouseObject;
|
||||
class AuraScript;
|
||||
@@ -1171,13 +1169,9 @@ public:
|
||||
virtual void OnStop(uint16 /*EventID*/) { }
|
||||
};
|
||||
|
||||
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||
#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
|
||||
|
||||
// Manages registration, loading, and execution of scripts.
|
||||
class ScriptMgr
|
||||
{
|
||||
friend class ACE_Singleton<ScriptMgr, ACE_Null_Mutex>;
|
||||
friend class ScriptObject;
|
||||
|
||||
private:
|
||||
@@ -1187,6 +1181,7 @@ class ScriptMgr
|
||||
|
||||
public: /* Initialization */
|
||||
|
||||
static ScriptMgr* instance();
|
||||
void Initialize();
|
||||
void LoadDatabase();
|
||||
void FillSpellSummary();
|
||||
@@ -1529,6 +1524,8 @@ class ScriptMgr
|
||||
std::atomic<long> _scheduledScripts;
|
||||
};
|
||||
|
||||
#define sScriptMgr ScriptMgr::instance()
|
||||
|
||||
template<class TScript>
|
||||
class ScriptRegistry
|
||||
{
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
|
||||
ScriptPointVector const SystemMgr::_empty;
|
||||
|
||||
SystemMgr* SystemMgr::instance()
|
||||
{
|
||||
static SystemMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void SystemMgr::LoadScriptWaypoints()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#define SC_SYSTEM_H
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
|
||||
|
||||
@@ -49,11 +48,12 @@ typedef std::vector<ScriptPointMove> ScriptPointVector;
|
||||
|
||||
class SystemMgr
|
||||
{
|
||||
friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>;
|
||||
SystemMgr() {}
|
||||
~SystemMgr() {}
|
||||
|
||||
public:
|
||||
static SystemMgr* instance();
|
||||
|
||||
typedef std::unordered_map<uint32, ScriptPointVector> PointMoveMap;
|
||||
|
||||
//Database
|
||||
@@ -76,6 +76,6 @@ class SystemMgr
|
||||
static ScriptPointVector const _empty;
|
||||
};
|
||||
|
||||
#define sScriptSystemMgr ACE_Singleton<SystemMgr, ACE_Null_Mutex>::instance()
|
||||
#define sScriptSystemMgr SystemMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user