mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-13 23:43:44 +00:00
feat(Core/Misc): remove and replace ACE_Singleton (#2418)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user