mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
feat(Core/Misc): remove and replace ACE_Singleton (#2418)
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "QueryResult.h"
|
||||
#include "Map.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ ArenaTeamMgr::~ArenaTeamMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
ArenaTeamMgr* ArenaTeamMgr::instance()
|
||||
{
|
||||
static ArenaTeamMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// Arena teams collection
|
||||
ArenaTeam* ArenaTeamMgr::GetArenaTeamById(uint32 arenaTeamId) const
|
||||
{
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
|
||||
class ArenaTeamMgr
|
||||
{
|
||||
friend class ACE_Singleton<ArenaTeamMgr, ACE_Null_Mutex>;
|
||||
ArenaTeamMgr();
|
||||
~ArenaTeamMgr();
|
||||
|
||||
public:
|
||||
static ArenaTeamMgr* instance();
|
||||
|
||||
typedef std::unordered_map<uint32, ArenaTeam*> ArenaTeamContainer;
|
||||
|
||||
ArenaTeam* GetArenaTeamById(uint32 arenaTeamId) const;
|
||||
@@ -43,6 +44,6 @@ protected:
|
||||
uint32 LastArenaLogId;
|
||||
};
|
||||
|
||||
#define sArenaTeamMgr ACE_Singleton<ArenaTeamMgr, ACE_Null_Mutex>::instance()
|
||||
#define sArenaTeamMgr ArenaTeamMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,12 @@ BattlegroundMgr::~BattlegroundMgr()
|
||||
DeleteAllBattlegrounds();
|
||||
}
|
||||
|
||||
BattlegroundMgr* BattlegroundMgr::instance()
|
||||
{
|
||||
static BattlegroundMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::DeleteAllBattlegrounds()
|
||||
{
|
||||
while (!m_Battlegrounds.empty())
|
||||
|
||||
@@ -12,14 +12,12 @@
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundQueue.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <unordered_map>
|
||||
|
||||
typedef std::map<uint32, Battleground*> BattlegroundContainer;
|
||||
typedef std::unordered_map<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
typedef Battleground*(*bgRef)(Battleground*);
|
||||
|
||||
|
||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // how many seconds in day
|
||||
|
||||
struct CreateBattlegroundData
|
||||
@@ -62,13 +60,13 @@ class RandomBattlegroundSystem
|
||||
|
||||
class BattlegroundMgr
|
||||
{
|
||||
friend class ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
BattlegroundMgr();
|
||||
~BattlegroundMgr();
|
||||
|
||||
public:
|
||||
static BattlegroundMgr* instance();
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* Packet Building */
|
||||
@@ -161,5 +159,6 @@ class BattlegroundMgr
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
};
|
||||
|
||||
#define sBattlegroundMgr ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>::instance()
|
||||
#endif
|
||||
#define sBattlegroundMgr BattlegroundMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user