Get rid of Trinity Singleton and Threading patterns and replace them with ACE_Singletons and ACE_GUARD_x macro´s with ACE_Thread_Mutex´es respectively.
Also get rid of unused CountedReference class that used Trinity threading pattern. --HG-- branch : trunk
This commit is contained in:
@@ -27,13 +27,10 @@
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "SingletonImp.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1(GameEventMgr);
|
||||
|
||||
bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
{
|
||||
switch(mGameEvent[entry].state)
|
||||
@@ -1270,7 +1267,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
objmgr.AddCreatureToGrid(*itr, data);
|
||||
|
||||
// Spawn if necessary (loaded grids only)
|
||||
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
|
||||
// We use spawn coords to spawn
|
||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
||||
{
|
||||
@@ -1298,7 +1295,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||
objmgr.AddGameobjectToGrid(*itr, data);
|
||||
// Spawn if necessary (loaded grids only)
|
||||
// this base map checked as non-instanced and then only existed
|
||||
Map* map = const_cast<Map*>(MapManager::Instance().CreateBaseMap(data->mapid));
|
||||
Map* map = const_cast<Map*>(sMapMgr.CreateBaseMap(data->mapid));
|
||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
||||
{
|
||||
@@ -1345,7 +1342,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
||||
{
|
||||
objmgr.RemoveCreatureFromGrid(*itr, data);
|
||||
|
||||
if (Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
|
||||
if (Creature* pCreature = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL))
|
||||
pCreature->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
@@ -1366,7 +1363,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
||||
{
|
||||
objmgr.RemoveGameobjectFromGrid(*itr, data);
|
||||
|
||||
if (GameObject* pGameobject = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
|
||||
if (GameObject* pGameobject = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1389,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
|
||||
continue;
|
||||
|
||||
// Update if spawned
|
||||
Creature* pCreature = ObjectAccessor::Instance().GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL);
|
||||
Creature* pCreature = sObjectAccessor.GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id,HIGHGUID_UNIT), (Creature*)NULL);
|
||||
if (pCreature)
|
||||
{
|
||||
if (activate)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Define.h"
|
||||
#include "Singleton.h"
|
||||
#include "ace/Singleton.h"
|
||||
|
||||
#define max_ge_check_delay DAY // 1 day in seconds
|
||||
|
||||
@@ -92,9 +92,11 @@ class Creature;
|
||||
|
||||
class GameEventMgr
|
||||
{
|
||||
friend class ACE_Singleton<GameEventMgr, ACE_Null_Mutex>;
|
||||
GameEventMgr();
|
||||
public:
|
||||
GameEventMgr();
|
||||
~GameEventMgr() {};
|
||||
|
||||
typedef std::set<uint16> ActiveEvents;
|
||||
typedef std::vector<GameEventData> GameEventDataMap;
|
||||
ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
|
||||
@@ -172,7 +174,7 @@ class GameEventMgr
|
||||
GameEventGuidMap mGameEventGameobjectGuids;
|
||||
};
|
||||
|
||||
#define gameeventmgr Trinity::Singleton<GameEventMgr>::Instance()
|
||||
#define gameeventmgr (*ACE_Singleton<GameEventMgr, ACE_Null_Mutex>::instance())
|
||||
|
||||
bool IsHolidayActive(HolidayIds id);
|
||||
bool IsEventActive(uint16 event_id);
|
||||
|
||||
Reference in New Issue
Block a user