mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
feat(Core/Misc): remove and replace ACE_Singleton (#2418)
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include "WorldModel.h"
|
||||
#include <G3D/Vector3.h>
|
||||
#include <ace/Null_Mutex.h>
|
||||
#include <ace/Singleton.h>
|
||||
#include "DisableMgr.h"
|
||||
#include "DBCStores.h"
|
||||
#include "Log.h"
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
|
||||
ConfigMgr* ConfigMgr::instance()
|
||||
{
|
||||
static ConfigMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// Defined here as it must not be exposed to end-users.
|
||||
bool ConfigMgr::GetValueHelper(const char* name, ACE_TString &result)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Configuration_Import_Export.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <AutoPtr.h>
|
||||
@@ -19,13 +18,12 @@ typedef acore::AutoPtr<ACE_Configuration_Heap, ACE_Null_Mutex> Config;
|
||||
|
||||
class ConfigMgr
|
||||
{
|
||||
friend class ACE_Singleton<ConfigMgr, ACE_Null_Mutex>;
|
||||
friend class ConfigLoader;
|
||||
|
||||
ConfigMgr() { }
|
||||
~ConfigMgr() { }
|
||||
|
||||
public:
|
||||
|
||||
static ConfigMgr* instance();
|
||||
|
||||
/// Method used only for loading main configuration files (authserver.conf and worldserver.conf)
|
||||
bool LoadInitial(char const* file);
|
||||
|
||||
@@ -62,10 +60,12 @@ private:
|
||||
Config _config;
|
||||
LockType _configLock;
|
||||
|
||||
ConfigMgr(ConfigMgr const&);
|
||||
ConfigMgr& operator=(ConfigMgr const&);
|
||||
ConfigMgr() = default;
|
||||
ConfigMgr(ConfigMgr const&) = delete;
|
||||
ConfigMgr& operator=(ConfigMgr const&) = delete;
|
||||
~ConfigMgr() = default;
|
||||
};
|
||||
|
||||
#define sConfigMgr ACE_Singleton<ConfigMgr, ACE_Null_Mutex>::instance()
|
||||
#define sConfigMgr ConfigMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,30 +11,30 @@
|
||||
#include "Dynamic/TypeList.h"
|
||||
#include "ObjectRegistry.h"
|
||||
|
||||
/** FactoryHolder holds a factory object of a specific type
|
||||
/*
|
||||
* FactoryHolder holds a factory object of a specific type
|
||||
*/
|
||||
template<class T, class Key = std::string>
|
||||
class FactoryHolder
|
||||
{
|
||||
public:
|
||||
typedef ObjectRegistry<FactoryHolder<T, Key >, Key > FactoryHolderRegistry;
|
||||
friend class ACE_Singleton<FactoryHolderRegistry, ACE_Null_Mutex>;
|
||||
typedef ACE_Singleton<FactoryHolderRegistry, ACE_Null_Mutex> FactoryHolderRepository;
|
||||
public:
|
||||
typedef ObjectRegistry<FactoryHolder<T, Key >, Key > FactoryHolderRegistry;
|
||||
|
||||
FactoryHolder(Key k) : i_key(k) { }
|
||||
virtual ~FactoryHolder() { }
|
||||
inline Key key() const { return i_key; }
|
||||
FactoryHolder(Key k) : i_key(k) { }
|
||||
virtual ~FactoryHolder() { }
|
||||
inline Key key() const { return i_key; }
|
||||
|
||||
void RegisterSelf(void) { FactoryHolderRepository::instance()->InsertItem(this, i_key); }
|
||||
void DeregisterSelf(void) { FactoryHolderRepository::instance()->RemoveItem(this, false); }
|
||||
void RegisterSelf(void) { FactoryHolderRegistry::instance()->InsertItem(this, i_key); }
|
||||
void DeregisterSelf(void) { FactoryHolderRegistry::instance()->RemoveItem(this, false); }
|
||||
|
||||
/// Abstract Factory create method
|
||||
virtual T* Create(void *data = NULL) const = 0;
|
||||
private:
|
||||
Key i_key;
|
||||
/// Abstract Factory create method
|
||||
virtual T* Create(void* data = NULL) const = 0;
|
||||
private:
|
||||
Key i_key;
|
||||
};
|
||||
|
||||
/** Permissible is a classic way of letting the object decide
|
||||
/*
|
||||
* Permissible is a classic way of letting the object decide
|
||||
* whether how good they handle things. This is not retricted
|
||||
* to factory selectors.
|
||||
*/
|
||||
@@ -45,5 +45,5 @@ class Permissible
|
||||
virtual ~Permissible() { }
|
||||
virtual int Permit(const T *) const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_OBJECTREGISTRY_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -29,6 +28,12 @@ class ObjectRegistry
|
||||
return( iter == i_registeredObjects.end() ? NULL : iter->second );
|
||||
}
|
||||
|
||||
static ObjectRegistry<T, Key>* instance()
|
||||
{
|
||||
static ObjectRegistry<T, Key>* instance = new ObjectRegistry<T, Key>();
|
||||
return instance;
|
||||
}
|
||||
|
||||
/// Inserts a registry item
|
||||
bool InsertItem(T *obj, Key key, bool override = false)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,12 @@ Log::~Log()
|
||||
miscLogFile = NULL;
|
||||
}
|
||||
|
||||
Log* Log::instance()
|
||||
{
|
||||
static Log instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void Log::SetLogLevel(char *Level)
|
||||
{
|
||||
int32 NewLevel = atoi((char*)Level);
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Task.h>
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
class WorldPacket;
|
||||
|
||||
@@ -96,13 +95,17 @@ const int Colors = int(WHITE)+1;
|
||||
|
||||
class Log
|
||||
{
|
||||
friend class ACE_Singleton<Log, ACE_Thread_Mutex>;
|
||||
|
||||
private:
|
||||
Log();
|
||||
~Log();
|
||||
Log(Log const&) = delete;
|
||||
Log(Log&&) = delete;
|
||||
Log& operator=(Log const&) = delete;
|
||||
Log& operator=(Log&&) = delete;
|
||||
|
||||
public:
|
||||
static Log* instance();
|
||||
|
||||
void Initialize();
|
||||
|
||||
void ReloadConfig();
|
||||
@@ -194,7 +197,7 @@ class Log
|
||||
DebugLogFilters m_DebugLogMask;
|
||||
};
|
||||
|
||||
#define sLog ACE_Singleton<Log, ACE_Thread_Mutex>::instance()
|
||||
#define sLog Log::instance()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <ace/Log_Msg.h>
|
||||
#include "Threading.h"
|
||||
|
||||
#include "DelayExecutor.h"
|
||||
|
||||
DelayExecutor* DelayExecutor::instance()
|
||||
{
|
||||
return ACE_Singleton<DelayExecutor, ACE_Thread_Mutex>::instance();
|
||||
static DelayExecutor instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
DelayExecutor::DelayExecutor()
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#ifndef ACORE_CREATUREAIFACTORY_H
|
||||
#define ACORE_CREATUREAIFACTORY_H
|
||||
|
||||
//#include "Policies/Singleton.h"
|
||||
#include "ObjectRegistry.h"
|
||||
#include "FactoryHolder.h"
|
||||
#include "GameObjectAI.h"
|
||||
@@ -36,7 +35,6 @@ CreatureAIFactory<REAL_AI>::Create(void* data) const
|
||||
|
||||
typedef FactoryHolder<CreatureAI> CreatureAICreator;
|
||||
typedef FactoryHolder<CreatureAI>::FactoryHolderRegistry CreatureAIRegistry;
|
||||
typedef FactoryHolder<CreatureAI>::FactoryHolderRepository CreatureAIRepository;
|
||||
|
||||
//GO
|
||||
struct SelectableGameObjectAI : public FactoryHolder<GameObjectAI>, public Permissible<GameObject>
|
||||
@@ -64,5 +62,5 @@ GameObjectAIFactory<REAL_GO_AI>::Create(void* data) const
|
||||
|
||||
typedef FactoryHolder<GameObjectAI> GameObjectAICreator;
|
||||
typedef FactoryHolder<GameObjectAI>::FactoryHolderRegistry GameObjectAIRegistry;
|
||||
typedef FactoryHolder<GameObjectAI>::FactoryHolderRepository GameObjectAIRepository;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace FactorySelector
|
||||
CreatureAI* selectAI(Creature* creature)
|
||||
{
|
||||
const CreatureAICreator* ai_factory = NULL;
|
||||
CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance());
|
||||
CreatureAIRegistry& ai_registry(*CreatureAIRegistry::instance());
|
||||
|
||||
// xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai
|
||||
// xinef: dont remember why i changed this qq commented out as may break some quests
|
||||
@@ -92,7 +92,7 @@ namespace FactorySelector
|
||||
|
||||
MovementGenerator* selectMovementGenerator(Creature* creature)
|
||||
{
|
||||
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
||||
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRegistry::instance());
|
||||
ASSERT(creature->GetCreatureTemplate());
|
||||
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace FactorySelector
|
||||
GameObjectAI* SelectGameObjectAI(GameObject* go)
|
||||
{
|
||||
const GameObjectAICreator* ai_factory = NULL;
|
||||
GameObjectAIRegistry& ai_registry(*GameObjectAIRepository::instance());
|
||||
GameObjectAIRegistry& ai_registry(*GameObjectAIRegistry::instance());
|
||||
|
||||
if (GameObjectAI* scriptedAI = sScriptMgr->GetGameObjectAI(go))
|
||||
return scriptedAI;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2333,6 +2333,12 @@ bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria,
|
||||
return true;
|
||||
}
|
||||
|
||||
AchievementGlobalMgr* AchievementGlobalMgr::instance()
|
||||
{
|
||||
static AchievementGlobalMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool AchievementGlobalMgr::IsStatisticCriteria(AchievementCriteriaEntry const* achievementCriteria) const
|
||||
{
|
||||
return isStatisticAchievement(sAchievementStore.LookupEntry(achievementCriteria->referredAchievement));
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <chrono>
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "DBCStores.h"
|
||||
@@ -295,11 +294,12 @@ class AchievementMgr
|
||||
|
||||
class AchievementGlobalMgr
|
||||
{
|
||||
friend class ACE_Singleton<AchievementGlobalMgr, ACE_Null_Mutex>;
|
||||
AchievementGlobalMgr() {}
|
||||
~AchievementGlobalMgr() {}
|
||||
|
||||
public:
|
||||
static AchievementGlobalMgr* instance();
|
||||
|
||||
bool IsStatisticCriteria(AchievementCriteriaEntry const* achievementCriteria) const;
|
||||
bool isStatisticAchievement(AchievementEntry const* achievement) const;
|
||||
|
||||
@@ -388,6 +388,6 @@ class AchievementGlobalMgr
|
||||
std::map<uint32, AchievementCriteriaEntryList> m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL];
|
||||
};
|
||||
|
||||
#define sAchievementMgr ACE_Singleton<AchievementGlobalMgr, ACE_Null_Mutex>::instance()
|
||||
#define sAchievementMgr AchievementGlobalMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,12 @@ AuctionHouseMgr::~AuctionHouseMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
AuctionHouseMgr* AuctionHouseMgr::instance()
|
||||
{
|
||||
static AuctionHouseMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef _AUCTION_HOUSE_MGR_H
|
||||
#define _AUCTION_HOUSE_MGR_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
@@ -131,8 +129,6 @@ class AuctionHouseObject
|
||||
|
||||
class AuctionHouseMgr
|
||||
{
|
||||
friend class ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
AuctionHouseMgr();
|
||||
~AuctionHouseMgr();
|
||||
@@ -141,6 +137,8 @@ class AuctionHouseMgr
|
||||
|
||||
typedef std::unordered_map<uint32, Item*> ItemMap;
|
||||
|
||||
static AuctionHouseMgr* instance();
|
||||
|
||||
AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId);
|
||||
AuctionHouseObject* GetBidsMap(uint32 factionTemplateId);
|
||||
|
||||
@@ -184,6 +182,6 @@ class AuctionHouseMgr
|
||||
ItemMap mAitems;
|
||||
};
|
||||
|
||||
#define sAuctionMgr ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>::instance()
|
||||
#define sAuctionMgr AuctionHouseMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,12 @@ BattlefieldMgr::~BattlefieldMgr()
|
||||
delete *itr;
|
||||
}
|
||||
|
||||
BattlefieldMgr* BattlefieldMgr::instance()
|
||||
{
|
||||
static BattlefieldMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void BattlefieldMgr::InitBattlefield()
|
||||
{
|
||||
Battlefield* pBf = new BattlefieldWG;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define BATTLEFIELD_MGR_H_
|
||||
|
||||
#include "Battlefield.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
class Player;
|
||||
class GameObject;
|
||||
@@ -25,6 +24,8 @@ class BattlefieldMgr
|
||||
// dtor
|
||||
~BattlefieldMgr();
|
||||
|
||||
static BattlefieldMgr* instance();
|
||||
|
||||
// create battlefield events
|
||||
void InitBattlefield();
|
||||
// called when a player enters an battlefield area
|
||||
@@ -62,6 +63,6 @@ class BattlefieldMgr
|
||||
uint32 m_UpdateTimer;
|
||||
};
|
||||
|
||||
#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
|
||||
#define sBattlefieldMgr BattlefieldMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,6 +34,12 @@ CalendarMgr::~CalendarMgr()
|
||||
delete *itr2;
|
||||
}
|
||||
|
||||
CalendarMgr* CalendarMgr::instance()
|
||||
{
|
||||
static CalendarMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void CalendarMgr::LoadFromDB()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef ACORE_CALENDARMGR_H
|
||||
#define ACORE_CALENDARMGR_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
@@ -257,8 +256,6 @@ typedef std::unordered_map<uint64 /* eventId */, CalendarInviteStore > CalendarE
|
||||
|
||||
class CalendarMgr
|
||||
{
|
||||
friend class ACE_Singleton<CalendarMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
CalendarMgr();
|
||||
~CalendarMgr();
|
||||
@@ -272,6 +269,8 @@ class CalendarMgr
|
||||
uint64 _maxInviteId;
|
||||
|
||||
public:
|
||||
static CalendarMgr* instance();
|
||||
|
||||
void LoadFromDB();
|
||||
|
||||
CalendarEvent* GetEvent(uint64 eventId, CalendarEventStore::iterator* it = NULL);
|
||||
@@ -318,6 +317,6 @@ class CalendarMgr
|
||||
void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent);
|
||||
};
|
||||
|
||||
#define sCalendarMgr ACE_Singleton<CalendarMgr, ACE_Null_Mutex>::instance()
|
||||
#define sCalendarMgr CalendarMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,19 +18,21 @@ ChannelMgr::~ChannelMgr()
|
||||
|
||||
ChannelMgr* ChannelMgr::forTeam(TeamId teamId)
|
||||
{
|
||||
static ChannelMgr allianceChannelMgr(TEAM_ALLIANCE);
|
||||
static ChannelMgr hordeChannelMgr(TEAM_HORDE);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
|
||||
return &allianceChannelMgr; // cross-faction
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
|
||||
return &allianceChannelMgr;
|
||||
|
||||
if (teamId == TEAM_HORDE)
|
||||
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
|
||||
return &hordeChannelMgr;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void ChannelMgr::LoadChannels()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -8,13 +8,10 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Channel.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#include "World.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "World.h"
|
||||
|
||||
#define MAX_CHANNEL_PASS_STR 31
|
||||
|
||||
class ChannelMgr
|
||||
|
||||
@@ -597,6 +597,12 @@ ConditionMgr::~ConditionMgr()
|
||||
Clean();
|
||||
}
|
||||
|
||||
ConditionMgr* ConditionMgr::instance()
|
||||
{
|
||||
static ConditionMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
|
||||
{
|
||||
ConditionList conditions;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "Define.h"
|
||||
#include "Errors.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
@@ -229,13 +228,13 @@ typedef std::map<uint32, ConditionList> ConditionReferenceContainer;//only used
|
||||
|
||||
class ConditionMgr
|
||||
{
|
||||
friend class ACE_Singleton<ConditionMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
ConditionMgr();
|
||||
~ConditionMgr();
|
||||
|
||||
public:
|
||||
static ConditionMgr* instance();
|
||||
|
||||
void LoadConditions(bool isReload = false);
|
||||
bool isConditionTypeValid(Condition* cond);
|
||||
ConditionList GetConditionReferences(uint32 refId);
|
||||
@@ -271,6 +270,6 @@ class ConditionMgr
|
||||
SmartEventConditionContainer SmartEventConditionStore;
|
||||
};
|
||||
|
||||
#define sConditionMgr ACE_Singleton<ConditionMgr, ACE_Null_Mutex>::instance()
|
||||
#define sConditionMgr ConditionMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,6 +45,12 @@ LFGMgr::~LFGMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
LFGMgr* LFGMgr::instance()
|
||||
{
|
||||
static LFGMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
|
||||
{
|
||||
if (!fields)
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef _LFGMGR_H
|
||||
#define _LFGMGR_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include "DBCStructure.h"
|
||||
#include "Field.h"
|
||||
#include "LFG.h"
|
||||
@@ -379,8 +378,6 @@ struct LFGDungeonData
|
||||
|
||||
class LFGMgr
|
||||
{
|
||||
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
LFGMgr();
|
||||
~LFGMgr();
|
||||
@@ -401,6 +398,8 @@ class LFGMgr
|
||||
RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions
|
||||
|
||||
public:
|
||||
static LFGMgr* instance();
|
||||
|
||||
// Functions used outside lfg namespace
|
||||
void Update(uint32 diff, uint8 task);
|
||||
|
||||
@@ -590,5 +589,6 @@ class LFGMgr
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
#define sLFGMgr ACE_Singleton<lfg::LFGMgr, ACE_Null_Mutex>::instance()
|
||||
#define sLFGMgr lfg::LFGMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,6 +17,12 @@ FormationMgr::~FormationMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
FormationMgr* FormationMgr::instance()
|
||||
{
|
||||
static FormationMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
|
||||
{
|
||||
Map* map = member->FindMap();
|
||||
|
||||
@@ -28,10 +28,12 @@ typedef std::unordered_map<uint32/*memberDBGUID*/, FormationInfo*> CreatureGro
|
||||
|
||||
class FormationMgr
|
||||
{
|
||||
friend class ACE_Singleton<FormationMgr, ACE_Null_Mutex>;
|
||||
public:
|
||||
FormationMgr() { }
|
||||
~FormationMgr();
|
||||
|
||||
static FormationMgr* instance();
|
||||
|
||||
void AddCreatureToGroup(uint32 group_id, Creature* creature);
|
||||
void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature);
|
||||
void LoadCreatureFormations();
|
||||
@@ -69,6 +71,6 @@ class CreatureGroup
|
||||
bool m_Formed;
|
||||
};
|
||||
|
||||
#define sFormationMgr ACE_Singleton<FormationMgr, ACE_Null_Mutex>::instance()
|
||||
#define sFormationMgr FormationMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -196,6 +196,12 @@ SocialMgr::~SocialMgr()
|
||||
{
|
||||
}
|
||||
|
||||
SocialMgr* SocialMgr::instance()
|
||||
{
|
||||
static SocialMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &friendInfo)
|
||||
{
|
||||
if (!player)
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
#ifndef __ACORE_SOCIALMGR_H
|
||||
#define __ACORE_SOCIALMGR_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
class SocialMgr;
|
||||
class PlayerSocial;
|
||||
@@ -112,13 +111,13 @@ class PlayerSocial
|
||||
|
||||
class SocialMgr
|
||||
{
|
||||
friend class ACE_Singleton<SocialMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
SocialMgr();
|
||||
~SocialMgr();
|
||||
|
||||
public:
|
||||
static SocialMgr* instance();
|
||||
|
||||
// Misc
|
||||
void RemovePlayerSocial(uint32 guid) { m_socialMap.erase(guid); }
|
||||
|
||||
@@ -133,6 +132,6 @@ class SocialMgr
|
||||
SocialMap m_socialMap;
|
||||
};
|
||||
|
||||
#define sSocialMgr ACE_Singleton<SocialMgr, ACE_Null_Mutex>::instance()
|
||||
#endif
|
||||
#define sSocialMgr SocialMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
GameEventMgr* GameEventMgr::instance()
|
||||
{
|
||||
static GameEventMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
{
|
||||
switch (mGameEvent[entry].state)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#define max_ge_check_delay DAY // 1 day in seconds
|
||||
|
||||
@@ -83,13 +81,13 @@ class Quest;
|
||||
|
||||
class GameEventMgr
|
||||
{
|
||||
friend class ACE_Singleton<GameEventMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
GameEventMgr();
|
||||
~GameEventMgr() {};
|
||||
|
||||
public:
|
||||
static GameEventMgr* instance();
|
||||
|
||||
typedef std::set<uint16> ActiveEvents;
|
||||
typedef std::vector<GameEventData> GameEventDataMap;
|
||||
ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
|
||||
@@ -169,7 +167,7 @@ class GameEventMgr
|
||||
std::set<uint32> modifiedHolidays;
|
||||
};
|
||||
|
||||
#define sGameEventMgr ACE_Singleton<GameEventMgr, ACE_Null_Mutex>::instance()
|
||||
#define sGameEventMgr GameEventMgr::instance()
|
||||
|
||||
bool IsHolidayActive(HolidayIds id);
|
||||
bool IsEventActive(uint16 event_id);
|
||||
|
||||
@@ -35,6 +35,12 @@ ObjectAccessor::~ObjectAccessor()
|
||||
{
|
||||
}
|
||||
|
||||
ObjectAccessor* ObjectAccessor::instance()
|
||||
{
|
||||
static ObjectAccessor instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/)
|
||||
{
|
||||
Player* player = HashMapHolder<Player>::Find(guid);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "UpdateData.h"
|
||||
#include "GridDefines.h"
|
||||
#include "Object.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
@@ -87,7 +86,6 @@ public:
|
||||
|
||||
class ObjectAccessor
|
||||
{
|
||||
friend class ACE_Singleton<ObjectAccessor, ACE_Null_Mutex>;
|
||||
private:
|
||||
ObjectAccessor();
|
||||
~ObjectAccessor();
|
||||
@@ -95,6 +93,7 @@ class ObjectAccessor
|
||||
ObjectAccessor& operator=(const ObjectAccessor&);
|
||||
|
||||
public:
|
||||
static ObjectAccessor* instance();
|
||||
// TODO: override these template functions for each holder type and add assertions
|
||||
|
||||
template<class T> static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/)
|
||||
@@ -277,5 +276,6 @@ class ObjectAccessor
|
||||
mutable ACE_Thread_Mutex DelayedCorpseLock;
|
||||
};
|
||||
|
||||
#define sObjectAccessor ACE_Singleton<ObjectAccessor, ACE_Null_Mutex>::instance()
|
||||
#define sObjectAccessor ObjectAccessor::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -270,6 +270,12 @@ ObjectMgr::~ObjectMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
ObjectMgr* ObjectMgr::instance()
|
||||
{
|
||||
static ObjectMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data)
|
||||
{
|
||||
if (!s.empty())
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include "VehicleDefines.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -465,12 +464,14 @@ typedef std::unordered_map<uint32, BroadcastText> BroadcastTextContainer;
|
||||
|
||||
typedef std::set<uint32> CellGuidSet;
|
||||
typedef std::unordered_map<uint32/*player guid*/, uint32/*instance*/> CellCorpseSet;
|
||||
|
||||
struct CellObjectGuids
|
||||
{
|
||||
CellGuidSet creatures;
|
||||
CellGuidSet gameobjects;
|
||||
CellCorpseSet corpses;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32/*cell_id*/, CellObjectGuids> CellObjectGuidsMap;
|
||||
typedef std::unordered_map<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap> MapObjectGuids;
|
||||
|
||||
@@ -686,13 +687,14 @@ class PlayerDumpReader;
|
||||
class ObjectMgr
|
||||
{
|
||||
friend class PlayerDumpReader;
|
||||
friend class ACE_Singleton<ObjectMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
ObjectMgr();
|
||||
~ObjectMgr();
|
||||
|
||||
public:
|
||||
static ObjectMgr* instance();
|
||||
|
||||
typedef std::unordered_map<uint32, Item*> ItemMap;
|
||||
|
||||
typedef std::unordered_map<uint32, Quest*> QuestMap;
|
||||
@@ -1499,6 +1501,6 @@ class ObjectMgr
|
||||
std::set<uint32> _transportMaps; // Helper container storing map ids that are for transports only, loaded from gameobject_template
|
||||
};
|
||||
|
||||
#define sObjectMgr ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance()
|
||||
#define sObjectMgr ObjectMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,12 @@ GroupMgr::~GroupMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
GroupMgr* GroupMgr::instance()
|
||||
{
|
||||
static GroupMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void GroupMgr::InitGroupIds()
|
||||
{
|
||||
_nextGroupId = 1;
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
|
||||
class GroupMgr
|
||||
{
|
||||
friend class ACE_Singleton<GroupMgr, ACE_Null_Mutex>;
|
||||
private:
|
||||
GroupMgr();
|
||||
~GroupMgr();
|
||||
|
||||
public:
|
||||
static GroupMgr* instance();
|
||||
|
||||
typedef std::map<uint32, Group*> GroupContainer;
|
||||
|
||||
Group* GetGroupByGUID(uint32 guid) const;
|
||||
@@ -37,6 +38,6 @@ protected:
|
||||
GroupContainer GroupStore;
|
||||
};
|
||||
|
||||
#define sGroupMgr ACE_Singleton<GroupMgr, ACE_Null_Mutex>::instance()
|
||||
#define sGroupMgr GroupMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,12 @@ GuildMgr::~GuildMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
GuildMgr* GuildMgr::instance()
|
||||
{
|
||||
static GuildMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void GuildMgr::AddGuild(Guild* guild)
|
||||
{
|
||||
GuildStore[guild->GetId()] = guild;
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
class GuildMgr
|
||||
{
|
||||
friend class ACE_Singleton<GuildMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
GuildMgr();
|
||||
~GuildMgr();
|
||||
|
||||
public:
|
||||
static GuildMgr* instance();
|
||||
|
||||
Guild* GetGuildByLeader(uint64 guid) const;
|
||||
Guild* GetGuildById(uint32 guildId) const;
|
||||
Guild* GetGuildByName(std::string const& guildName) const;
|
||||
@@ -37,6 +37,6 @@ protected:
|
||||
GuildContainer GuildStore;
|
||||
};
|
||||
|
||||
#define sGuildMgr ACE_Singleton<GuildMgr, ACE_Null_Mutex>::instance()
|
||||
#define sGuildMgr GuildMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,12 @@ AddonHandler::~AddonHandler()
|
||||
{
|
||||
}
|
||||
|
||||
AddonHandler* AddonHandler::instance()
|
||||
{
|
||||
static AddonHandler instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
|
||||
{
|
||||
ByteBuffer AddOnPacked;
|
||||
|
||||
@@ -9,20 +9,20 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include "WorldPacket.h"
|
||||
|
||||
class AddonHandler
|
||||
{
|
||||
/* Construction */
|
||||
friend class ACE_Singleton<AddonHandler, ACE_Null_Mutex>;
|
||||
public:
|
||||
AddonHandler();
|
||||
~AddonHandler();
|
||||
|
||||
public:
|
||||
~AddonHandler();
|
||||
//build addon packet
|
||||
bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target);
|
||||
static AddonHandler* instance();
|
||||
|
||||
//build addon packet
|
||||
bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target);
|
||||
};
|
||||
#define sAddOnHandler ACE_Singleton<AddonHandler, ACE_Null_Mutex>::instance()
|
||||
#endif
|
||||
|
||||
#define sAddOnHandler AddonHandler::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,12 @@ InstanceSaveManager::~InstanceSaveManager()
|
||||
}*/
|
||||
}
|
||||
|
||||
InstanceSaveManager* InstanceSaveManager::instance()
|
||||
{
|
||||
static InstanceSaveManager instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
/*
|
||||
- adding instance into manager
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#include <ace/Null_Mutex.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include <list>
|
||||
@@ -98,7 +98,6 @@ typedef std::unordered_map<uint32 /*PAIR32(map, difficulty)*/, time_t /*resetTim
|
||||
|
||||
class InstanceSaveManager
|
||||
{
|
||||
friend class ACE_Singleton<InstanceSaveManager, ACE_Thread_Mutex>;
|
||||
friend class InstanceSave;
|
||||
|
||||
private:
|
||||
@@ -106,6 +105,8 @@ class InstanceSaveManager
|
||||
~InstanceSaveManager();
|
||||
|
||||
public:
|
||||
static InstanceSaveManager* instance();
|
||||
|
||||
typedef std::unordered_map<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveHashMap;
|
||||
|
||||
struct InstResetEvent
|
||||
@@ -189,5 +190,6 @@ class InstanceSaveManager
|
||||
ResetTimeQueue m_resetTimeQueue;
|
||||
};
|
||||
|
||||
#define sInstanceSaveMgr ACE_Singleton<InstanceSaveManager, ACE_Thread_Mutex>::instance()
|
||||
#define sInstanceSaveMgr InstanceSaveManager::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,12 @@ LootItemStorage::~LootItemStorage()
|
||||
{
|
||||
}
|
||||
|
||||
LootItemStorage* LootItemStorage::instance()
|
||||
{
|
||||
static LootItemStorage instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void LootItemStorage::LoadStorageFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -6,12 +6,10 @@ Xinef
|
||||
#define ACORE_LOOTITEMSTORAGE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
#include "ace/Singleton.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Item.h"
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
struct StoredLootItem
|
||||
{
|
||||
@@ -30,13 +28,13 @@ typedef std::unordered_map<uint32, StoredLootItemList> LootItemContainer;
|
||||
|
||||
class LootItemStorage
|
||||
{
|
||||
friend class ACE_Singleton<LootItemStorage, ACE_Thread_Mutex>;
|
||||
|
||||
private:
|
||||
LootItemStorage();
|
||||
~LootItemStorage();
|
||||
|
||||
public:
|
||||
static LootItemStorage* instance();
|
||||
|
||||
void LoadStorageFromDB();
|
||||
void RemoveEntryFromDB(uint32 containerId, uint32 itemid, uint32 count);
|
||||
|
||||
@@ -51,5 +49,6 @@ class LootItemStorage
|
||||
LootItemContainer lootItemStore;
|
||||
};
|
||||
|
||||
#define sLootItemStorage ACE_Singleton<LootItemStorage, ACE_Thread_Mutex>::instance()
|
||||
#define sLootItemStorage LootItemStorage::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,12 @@ MapManager::~MapManager()
|
||||
{
|
||||
}
|
||||
|
||||
MapManager* MapManager::instance()
|
||||
{
|
||||
static MapManager instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void MapManager::Initialize()
|
||||
{
|
||||
int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS));
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_MAPMANAGER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include "Common.h"
|
||||
#include "Map.h"
|
||||
@@ -22,9 +21,9 @@ struct TransportCreatureProto;
|
||||
|
||||
class MapManager
|
||||
{
|
||||
friend class ACE_Singleton<MapManager, ACE_Thread_Mutex>;
|
||||
|
||||
public:
|
||||
static MapManager* instance();
|
||||
|
||||
Map* CreateBaseMap(uint32 mapId);
|
||||
Map* FindBaseNonInstanceMap(uint32 mapId) const;
|
||||
Map* CreateMap(uint32 mapId, Player* player);
|
||||
@@ -140,5 +139,7 @@ class MapManager
|
||||
uint32 _nextInstanceId;
|
||||
MapUpdater m_updater;
|
||||
};
|
||||
#define sMapMgr ACE_Singleton<MapManager, ACE_Thread_Mutex>::instance()
|
||||
|
||||
#define sMapMgr MapManager::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,12 @@ TransportMgr::TransportMgr() { }
|
||||
|
||||
TransportMgr::~TransportMgr() { }
|
||||
|
||||
TransportMgr* TransportMgr::instance()
|
||||
{
|
||||
static TransportMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void TransportMgr::Unload()
|
||||
{
|
||||
_transportTemplates.clear();
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifndef TRANSPORTMGR_H
|
||||
#define TRANSPORTMGR_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include <G3D/Quat.h>
|
||||
#include "Spline.h"
|
||||
#include "DBCStores.h"
|
||||
@@ -89,65 +88,66 @@ typedef std::map<uint32, TransportAnimation> TransportAnimationContainer;
|
||||
|
||||
class TransportMgr
|
||||
{
|
||||
friend class ACE_Singleton<TransportMgr, ACE_Thread_Mutex>;
|
||||
friend void LoadDBCStores(std::string const&);
|
||||
friend void LoadDBCStores(std::string const&);
|
||||
|
||||
public:
|
||||
static TransportMgr* instance();
|
||||
|
||||
public:
|
||||
void Unload();
|
||||
void Unload();
|
||||
|
||||
void LoadTransportTemplates();
|
||||
void LoadTransportTemplates();
|
||||
|
||||
// Creates a transport using given GameObject template entry
|
||||
MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = NULL);
|
||||
// Creates a transport using given GameObject template entry
|
||||
MotionTransport* CreateTransport(uint32 entry, uint32 guid = 0, Map* map = NULL);
|
||||
|
||||
// Spawns all continent transports, used at core startup
|
||||
void SpawnContinentTransports();
|
||||
// Spawns all continent transports, used at core startup
|
||||
void SpawnContinentTransports();
|
||||
|
||||
// creates all transports for instance
|
||||
void CreateInstanceTransports(Map* map);
|
||||
// creates all transports for instance
|
||||
void CreateInstanceTransports(Map* map);
|
||||
|
||||
TransportTemplate const* GetTransportTemplate(uint32 entry) const
|
||||
{
|
||||
TransportTemplates::const_iterator itr = _transportTemplates.find(entry);
|
||||
if (itr != _transportTemplates.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
TransportTemplate const* GetTransportTemplate(uint32 entry) const
|
||||
{
|
||||
TransportTemplates::const_iterator itr = _transportTemplates.find(entry);
|
||||
if (itr != _transportTemplates.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TransportAnimation const* GetTransportAnimInfo(uint32 entry) const
|
||||
{
|
||||
TransportAnimationContainer::const_iterator itr = _transportAnimations.find(entry);
|
||||
if (itr != _transportAnimations.end())
|
||||
return &itr->second;
|
||||
TransportAnimation const* GetTransportAnimInfo(uint32 entry) const
|
||||
{
|
||||
TransportAnimationContainer::const_iterator itr = _transportAnimations.find(entry);
|
||||
if (itr != _transportAnimations.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
TransportMgr();
|
||||
~TransportMgr();
|
||||
TransportMgr(TransportMgr const&);
|
||||
TransportMgr& operator=(TransportMgr const&);
|
||||
// Generates and precaches a path for transport to avoid generation each time transport instance is created
|
||||
void GeneratePath(GameObjectTemplate const* goInfo, TransportTemplate* transport);
|
||||
|
||||
// Generates and precaches a path for transport to avoid generation each time transport instance is created
|
||||
void GeneratePath(GameObjectTemplate const* goInfo, TransportTemplate* transport);
|
||||
void AddPathNodeToTransport(uint32 transportEntry, uint32 timeSeg, TransportAnimationEntry const* node);
|
||||
|
||||
void AddPathNodeToTransport(uint32 transportEntry, uint32 timeSeg, TransportAnimationEntry const* node);
|
||||
void AddPathRotationToTransport(uint32 transportEntry, uint32 timeSeg, TransportRotationEntry const* node)
|
||||
{
|
||||
_transportAnimations[transportEntry].Rotations[timeSeg] = node;
|
||||
}
|
||||
|
||||
void AddPathRotationToTransport(uint32 transportEntry, uint32 timeSeg, TransportRotationEntry const* node)
|
||||
{
|
||||
_transportAnimations[transportEntry].Rotations[timeSeg] = node;
|
||||
}
|
||||
private:
|
||||
TransportMgr();
|
||||
~TransportMgr();
|
||||
TransportMgr(TransportMgr const&);
|
||||
TransportMgr& operator=(TransportMgr const&);
|
||||
|
||||
// Container storing transport templates
|
||||
TransportTemplates _transportTemplates;
|
||||
// Container storing transport templates
|
||||
TransportTemplates _transportTemplates;
|
||||
|
||||
// Container storing transport entries to create for instanced maps
|
||||
TransportInstanceMap _instanceTransports;
|
||||
// Container storing transport entries to create for instanced maps
|
||||
TransportInstanceMap _instanceTransports;
|
||||
|
||||
TransportAnimationContainer _transportAnimations;
|
||||
TransportAnimationContainer _transportAnimations;
|
||||
};
|
||||
|
||||
#define sTransportMgr ACE_Singleton<TransportMgr, ACE_Thread_Mutex>::instance()
|
||||
#define sTransportMgr TransportMgr::instance()
|
||||
|
||||
#endif // TRANSPORTMGR_H
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
#include "DBCStores.h"
|
||||
#include "Log.h"
|
||||
|
||||
Graveyard* Graveyard::instance()
|
||||
{
|
||||
static Graveyard instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void Graveyard::LoadGraveyardFromDB()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
struct GraveyardStruct
|
||||
{
|
||||
@@ -28,9 +27,8 @@ typedef std::pair<WGGraveyardContainer::iterator, WGGraveyardContainer::iterator
|
||||
|
||||
class Graveyard
|
||||
{
|
||||
friend class ACE_Singleton<Graveyard, ACE_Null_Mutex>;
|
||||
|
||||
public:
|
||||
static Graveyard* instance();
|
||||
|
||||
typedef std::unordered_map<uint32, GraveyardStruct> GraveyardContainer;
|
||||
|
||||
@@ -53,6 +51,6 @@ private:
|
||||
WGGraveyardContainer GraveyardStore;
|
||||
};
|
||||
|
||||
#define sGraveyard ACE_Singleton<Graveyard, ACE_Null_Mutex>::instance()
|
||||
#define sGraveyard Graveyard::instance()
|
||||
|
||||
#endif // _GAMEGRAVEYARD_H_
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_MOVEMENTGENERATOR_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include "ObjectRegistry.h"
|
||||
#include "FactoryHolder.h"
|
||||
#include "Common.h"
|
||||
@@ -82,5 +81,4 @@ struct MovementGeneratorFactory : public SelectableMovement
|
||||
|
||||
typedef FactoryHolder<MovementGenerator, MovementGeneratorType> MovementGeneratorCreator;
|
||||
typedef FactoryHolder<MovementGenerator, MovementGeneratorType>::FactoryHolderRegistry MovementGeneratorRegistry;
|
||||
typedef FactoryHolder<MovementGenerator, MovementGeneratorType>::FactoryHolderRepository MovementGeneratorRepository;
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,12 @@ WaypointMgr::~WaypointMgr()
|
||||
_waypointStore.clear();
|
||||
}
|
||||
|
||||
WaypointMgr* WaypointMgr::instance()
|
||||
{
|
||||
static WaypointMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void WaypointMgr::Load()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,6 +16,12 @@ OutdoorPvPMgr::OutdoorPvPMgr()
|
||||
//sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Instantiating OutdoorPvPMgr");
|
||||
}
|
||||
|
||||
OutdoorPvPMgr* OutdoorPvPMgr::instance()
|
||||
{
|
||||
static OutdoorPvPMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void OutdoorPvPMgr::Die()
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Deleting OutdoorPvPMgr");
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#define OUTDOORPVP_OBJECTIVE_UPDATE_INTERVAL 1000
|
||||
|
||||
#include "OutdoorPvP.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
class Player;
|
||||
class GameObject;
|
||||
@@ -27,13 +26,13 @@ struct OutdoorPvPData
|
||||
// class to handle player enter / leave / areatrigger / GO use events
|
||||
class OutdoorPvPMgr
|
||||
{
|
||||
friend class ACE_Singleton<OutdoorPvPMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
OutdoorPvPMgr();
|
||||
~OutdoorPvPMgr() {};
|
||||
|
||||
public:
|
||||
static OutdoorPvPMgr* instance();
|
||||
|
||||
// create outdoor pvp events
|
||||
void InitOutdoorPvP();
|
||||
|
||||
@@ -93,6 +92,6 @@ class OutdoorPvPMgr
|
||||
uint32 m_UpdateTimer;
|
||||
};
|
||||
|
||||
#define sOutdoorPvPMgr ACE_Singleton<OutdoorPvPMgr, ACE_Null_Mutex>::instance()
|
||||
#define sOutdoorPvPMgr OutdoorPvPMgr::instance()
|
||||
|
||||
#endif /*OUTDOOR_PVP_MGR_H_*/
|
||||
|
||||
@@ -17,6 +17,12 @@ PetitionMgr::~PetitionMgr()
|
||||
{
|
||||
}
|
||||
|
||||
PetitionMgr* PetitionMgr::instance()
|
||||
{
|
||||
static PetitionMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void PetitionMgr::LoadPetitions()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -6,7 +6,7 @@ Xinef
|
||||
#define _PETITIONMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <map>
|
||||
|
||||
typedef std::map<uint32, uint32> SignatureMap;
|
||||
|
||||
@@ -29,13 +29,13 @@ typedef std::map<uint32, Petition> PetitionContainer;
|
||||
|
||||
class PetitionMgr
|
||||
{
|
||||
friend class ACE_Singleton<PetitionMgr, ACE_Thread_Mutex>;
|
||||
|
||||
private:
|
||||
PetitionMgr();
|
||||
~PetitionMgr();
|
||||
|
||||
public:
|
||||
static PetitionMgr* instance();
|
||||
|
||||
void LoadPetitions();
|
||||
void LoadSignatures();
|
||||
|
||||
@@ -59,5 +59,6 @@ class PetitionMgr
|
||||
SignatureContainer SignatureStore;
|
||||
};
|
||||
|
||||
#define sPetitionMgr ACE_Singleton<PetitionMgr, ACE_Thread_Mutex>::instance()
|
||||
#define sPetitionMgr PetitionMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -537,6 +537,12 @@ PoolMgr::PoolMgr()
|
||||
{
|
||||
}
|
||||
|
||||
PoolMgr* PoolMgr::instance()
|
||||
{
|
||||
static PoolMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void PoolMgr::Initialize()
|
||||
{
|
||||
mQuestSearchMap.clear();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_POOLHANDLER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
#include "QuestDef.h"
|
||||
@@ -92,13 +91,13 @@ typedef std::pair<PooledQuestRelation::iterator, PooledQuestRelation::iterator>
|
||||
|
||||
class PoolMgr
|
||||
{
|
||||
friend class ACE_Singleton<PoolMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
PoolMgr();
|
||||
~PoolMgr() {};
|
||||
|
||||
public:
|
||||
static PoolMgr* instance();
|
||||
|
||||
void LoadFromDB();
|
||||
void LoadQuestPools();
|
||||
void SaveQuestsToDB(bool daily, bool weekly, bool other);
|
||||
@@ -151,7 +150,7 @@ class PoolMgr
|
||||
ActivePoolData mSpawnedData;
|
||||
};
|
||||
|
||||
#define sPoolMgr ACE_Singleton<PoolMgr, ACE_Null_Mutex>::instance()
|
||||
#define sPoolMgr PoolMgr::instance()
|
||||
|
||||
// Method that tell if the creature is part of a pool and return the pool id if yes
|
||||
template<>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,12 @@ PacketLog::~PacketLog()
|
||||
_file = NULL;
|
||||
}
|
||||
|
||||
PacketLog* PacketLog::instance()
|
||||
{
|
||||
static PacketLog instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void PacketLog::Initialize()
|
||||
{
|
||||
std::string logsDir = sConfigMgr->GetStringDefault("LogsDir", "");
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define ACORE_PACKETLOG_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
enum Direction
|
||||
{
|
||||
@@ -20,13 +19,13 @@ class WorldPacket;
|
||||
|
||||
class PacketLog
|
||||
{
|
||||
friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>;
|
||||
|
||||
private:
|
||||
PacketLog();
|
||||
~PacketLog();
|
||||
|
||||
public:
|
||||
static PacketLog* instance();
|
||||
|
||||
void Initialize();
|
||||
bool CanLogPacket() const { return (_file != NULL); }
|
||||
void LogPacket(WorldPacket const& packet, Direction direction);
|
||||
@@ -35,5 +34,6 @@ class PacketLog
|
||||
FILE* _file;
|
||||
};
|
||||
|
||||
#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance()
|
||||
#define sPacketLog PacketLog::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -219,6 +219,12 @@ WorldSocketMgr::~WorldSocketMgr()
|
||||
delete m_Acceptor;
|
||||
}
|
||||
|
||||
WorldSocketMgr* WorldSocketMgr::instance()
|
||||
{
|
||||
static WorldSocketMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
int
|
||||
WorldSocketMgr::StartReactiveIO (uint16 port, const char* address)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include <ace/Basic_Types.h>
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
|
||||
class WorldSocket;
|
||||
@@ -27,8 +26,9 @@ class WorldSocketMgr
|
||||
{
|
||||
public:
|
||||
friend class WorldSocket;
|
||||
friend class ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>;
|
||||
|
||||
static WorldSocketMgr* instance();
|
||||
|
||||
/// Start network, listen at address:port .
|
||||
int StartNetwork(uint16 port, const char* address);
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
class WorldSocketAcceptor* m_Acceptor;
|
||||
};
|
||||
|
||||
#define sWorldSocketMgr ACE_Singleton<WorldSocketMgr, ACE_Thread_Mutex>::instance()
|
||||
#define sWorldSocketMgr WorldSocketMgr::instance()
|
||||
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
@@ -351,6 +351,12 @@ SpellMgr::~SpellMgr()
|
||||
UnloadSpellInfoStore();
|
||||
}
|
||||
|
||||
SpellMgr* SpellMgr::instance()
|
||||
{
|
||||
static SpellMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
||||
bool SpellMgr::ComputeIsSpellValid(SpellInfo const *spellInfo, bool msg)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
// For static or at-server-startup loaded spell data
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Unit.h"
|
||||
@@ -354,8 +353,6 @@ struct SpellStackInfo
|
||||
typedef std::map<uint32, SpellStackInfo> SpellGroupMap;
|
||||
typedef std::map<uint32, SpellGroupStackFlags> SpellGroupStackMap;
|
||||
|
||||
|
||||
|
||||
struct SpellThreatEntry
|
||||
{
|
||||
int32 flatMod; // flat threat-value for this Spell - default: 0
|
||||
@@ -603,7 +600,6 @@ typedef std::set<uint32> TalentAdditionalSet;
|
||||
|
||||
class SpellMgr
|
||||
{
|
||||
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
|
||||
// Constructors
|
||||
private:
|
||||
SpellMgr();
|
||||
@@ -611,6 +607,8 @@ class SpellMgr
|
||||
|
||||
// Accessors (const or static functions)
|
||||
public:
|
||||
static SpellMgr* instance();
|
||||
|
||||
// Spell correctness for client using
|
||||
static bool ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg = true);
|
||||
static bool IsSpellValid(SpellInfo const* spellInfo);
|
||||
@@ -755,6 +753,6 @@ class SpellMgr
|
||||
TalentAdditionalSet mTalentSpellAdditionalSet;
|
||||
};
|
||||
|
||||
#define sSpellMgr ACE_Singleton<SpellMgr, ACE_Null_Mutex>::instance()
|
||||
#define sSpellMgr SpellMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,6 +63,12 @@ class PlayerTextBuilder
|
||||
WorldObject const* _target;
|
||||
};
|
||||
|
||||
CreatureTextMgr* CreatureTextMgr::instance()
|
||||
{
|
||||
static CreatureTextMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void CreatureTextMgr::LoadCreatureTexts()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -72,10 +72,11 @@ typedef std::unordered_map<uint64, CreatureTextRepeatGroup> CreatureTextRepeatMa
|
||||
|
||||
class CreatureTextMgr
|
||||
{
|
||||
friend class ACE_Singleton<CreatureTextMgr, ACE_Null_Mutex>;
|
||||
CreatureTextMgr() { }
|
||||
|
||||
public:
|
||||
static CreatureTextMgr* instance();
|
||||
|
||||
~CreatureTextMgr() { }
|
||||
void LoadCreatureTexts();
|
||||
void LoadCreatureTextLocales();
|
||||
@@ -103,7 +104,7 @@ class CreatureTextMgr
|
||||
LocaleCreatureTextMap mLocaleTextMap;
|
||||
};
|
||||
|
||||
#define sCreatureTextMgr ACE_Singleton<CreatureTextMgr, ACE_Null_Mutex>::instance()
|
||||
#define sCreatureTextMgr CreatureTextMgr::instance()
|
||||
|
||||
template<class Builder>
|
||||
class CreatureTextLocalizer
|
||||
|
||||
@@ -243,6 +243,12 @@ TicketMgr::~TicketMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
TicketMgr* TicketMgr::instance()
|
||||
{
|
||||
static TicketMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); }
|
||||
|
||||
void TicketMgr::ResetTickets()
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
#ifndef _TICKETMGR_H
|
||||
#define _TICKETMGR_H
|
||||
|
||||
#include <string>
|
||||
#include <ace/Singleton.h>
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include <string>
|
||||
|
||||
class ChatHandler;
|
||||
|
||||
@@ -169,17 +167,18 @@ private:
|
||||
std::string _response;
|
||||
std::string _chatLog; // No need to store in db, will be refreshed every session client side
|
||||
};
|
||||
|
||||
typedef std::map<uint32, GmTicket*> GmTicketList;
|
||||
|
||||
class TicketMgr
|
||||
{
|
||||
friend class ACE_Singleton<TicketMgr, ACE_Null_Mutex>;
|
||||
|
||||
private:
|
||||
TicketMgr();
|
||||
~TicketMgr();
|
||||
|
||||
public:
|
||||
static TicketMgr* instance();
|
||||
|
||||
void LoadTickets();
|
||||
void LoadSurveys();
|
||||
|
||||
@@ -246,6 +245,6 @@ protected:
|
||||
uint64 _lastChange;
|
||||
};
|
||||
|
||||
#define sTicketMgr ACE_Singleton<TicketMgr, ACE_Null_Mutex>::instance()
|
||||
#define sTicketMgr TicketMgr::instance()
|
||||
|
||||
#endif // _TICKETMGR_H
|
||||
|
||||
@@ -26,6 +26,12 @@ WardenCheckMgr::~WardenCheckMgr()
|
||||
delete itr->second;
|
||||
}
|
||||
|
||||
WardenCheckMgr* WardenCheckMgr::instance()
|
||||
{
|
||||
static WardenCheckMgr instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void WardenCheckMgr::LoadWardenChecks()
|
||||
{
|
||||
// Check if Warden is enabled by config before loading anything
|
||||
|
||||
@@ -36,11 +36,12 @@ struct WardenCheckResult
|
||||
|
||||
class WardenCheckMgr
|
||||
{
|
||||
friend class ACE_Singleton<WardenCheckMgr, ACE_Null_Mutex>;
|
||||
WardenCheckMgr();
|
||||
~WardenCheckMgr();
|
||||
|
||||
public:
|
||||
static WardenCheckMgr* instance();
|
||||
|
||||
// We have a linear key without any gaps, so we use vector for fast access
|
||||
typedef std::vector<WardenCheck*> CheckContainer;
|
||||
typedef std::map<uint32, WardenCheckResult*> CheckResultContainer;
|
||||
@@ -61,6 +62,6 @@ class WardenCheckMgr
|
||||
CheckResultContainer CheckResultStore;
|
||||
};
|
||||
|
||||
#define sWardenCheckMgr ACE_Singleton<WardenCheckMgr, ACE_Null_Mutex>::instance()
|
||||
#define sWardenCheckMgr WardenCheckMgr::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -158,6 +158,12 @@ World::~World()
|
||||
//TODO free addSessQueue
|
||||
}
|
||||
|
||||
World* World::instance()
|
||||
{
|
||||
static World instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
/// Find a player in a specified zone
|
||||
Player* World::FindPlayerInZone(uint32 zone)
|
||||
{
|
||||
@@ -182,7 +188,7 @@ bool World::IsClosed() const
|
||||
{
|
||||
return m_isClosed;
|
||||
}
|
||||
|
||||
|
||||
void World::SetClosed(bool val)
|
||||
{
|
||||
m_isClosed = val;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Atomic_Op.h>
|
||||
#include "SharedDefines.h"
|
||||
#include "QueryResult.h"
|
||||
@@ -563,11 +562,13 @@ struct PetitionData
|
||||
class World
|
||||
{
|
||||
public:
|
||||
static uint32 m_worldLoopCounter;
|
||||
|
||||
World();
|
||||
~World();
|
||||
|
||||
static World* instance();
|
||||
|
||||
static uint32 m_worldLoopCounter;
|
||||
|
||||
WorldSession* FindSession(uint32 id) const;
|
||||
WorldSession* FindOfflineSession(uint32 id) const;
|
||||
WorldSession* FindOfflineSessionForCharacterGUID(uint32 guidLow) const;
|
||||
@@ -897,7 +898,7 @@ class World
|
||||
|
||||
std::string m_configFileList;
|
||||
};
|
||||
|
||||
#define sWorld ACE_Singleton<World, ACE_Null_Mutex>::instance()
|
||||
|
||||
#define sWorld World::instance()
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(nullptr)) { }
|
||||
|
||||
RealmList* RealmList::instance()
|
||||
{
|
||||
static RealmList instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
// Load the realm list from the database
|
||||
void RealmList::Initialize(uint32 updateInterval)
|
||||
{
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
#ifndef _REALMLIST_H
|
||||
#define _REALMLIST_H
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Null_Mutex.h>
|
||||
#include <ace/INET_Addr.h>
|
||||
#include "Common.h"
|
||||
#include <ace/INET_Addr.h>
|
||||
|
||||
enum RealmFlags
|
||||
{
|
||||
@@ -50,10 +48,10 @@ public:
|
||||
RealmList();
|
||||
~RealmList() { }
|
||||
|
||||
static RealmList* instance();
|
||||
|
||||
void Initialize(uint32 updateInterval);
|
||||
|
||||
void UpdateIfNeed();
|
||||
|
||||
void AddRealm(const Realm& NewRealm) { m_realms[NewRealm.name] = NewRealm; }
|
||||
|
||||
RealmMap::const_iterator begin() const { return m_realms.begin(); }
|
||||
@@ -69,6 +67,6 @@ private:
|
||||
time_t m_NextUpdateTime;
|
||||
};
|
||||
|
||||
#define sRealmList ACE_Singleton<RealmList, ACE_Null_Mutex>::instance()
|
||||
#define sRealmList RealmList::instance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
\ingroup Trinityd
|
||||
*/
|
||||
|
||||
#include <ace/Sig_Handler.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "GitRevision.h"
|
||||
#include "SignalHandler.h"
|
||||
@@ -17,9 +15,9 @@
|
||||
#include "WorldRunnable.h"
|
||||
#include "WorldSocket.h"
|
||||
#include "WorldSocketMgr.h"
|
||||
#include "Configuration/Config.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/DatabaseWorkerPool.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseWorkerPool.h"
|
||||
|
||||
#include "CliRunnable.h"
|
||||
#include "Log.h"
|
||||
@@ -30,9 +28,9 @@
|
||||
#include "Util.h"
|
||||
#include "RealmList.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
#include "BigNumber.h"
|
||||
#include "OpenSSLCrypto.h"
|
||||
#include <ace/Sig_Handler.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "ServiceWin32.h"
|
||||
@@ -107,6 +105,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
Master* Master::instance()
|
||||
{
|
||||
static Master instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
/// Main function
|
||||
int Master::Run()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
class Master
|
||||
{
|
||||
public:
|
||||
static Master* instance();
|
||||
int Run();
|
||||
|
||||
private:
|
||||
@@ -26,7 +27,7 @@ class Master
|
||||
void ClearOnlineAccounts();
|
||||
};
|
||||
|
||||
#define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance()
|
||||
#define sMaster Master::instance()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user