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

@@ -27,6 +27,12 @@ WaypointMgr::~WaypointMgr()
_waypointStore.clear();
}
WaypointMgr* WaypointMgr::instance()
{
static WaypointMgr instance;
return &instance;
}
void WaypointMgr::Load()
{
uint32 oldMSTime = getMSTime();

View File

@@ -7,9 +7,9 @@
#ifndef ACORE_WAYPOINTMANAGER_H
#define ACORE_WAYPOINTMANAGER_H
#include <ace/Singleton.h>
#include <ace/Null_Mutex.h>
#include "Common.h"
#include <vector>
#include <unordered_map>
enum WaypointMoveType
{
@@ -36,9 +36,9 @@ typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer;
class WaypointMgr
{
friend class ACE_Singleton<WaypointMgr, ACE_Null_Mutex>;
public:
static WaypointMgr* instance();
// Attempts to reload a single path from database
void ReloadPath(uint32 id);
@@ -52,17 +52,16 @@ class WaypointMgr
if (itr != _waypointStore.end())
return &itr->second;
return NULL;
return nullptr;
}
private:
// Only allow instantiation from ACE_Singleton
WaypointMgr();
~WaypointMgr();
WaypointPathContainer _waypointStore;
};
#define sWaypointMgr ACE_Singleton<WaypointMgr, ACE_Null_Mutex>::instance()
#define sWaypointMgr WaypointMgr::instance()
#endif