Fix previous commit.

This commit is contained in:
H0zen 2016-03-25 15:19:45 +02:00
parent 2423af36c1
commit d011a70e97
2 changed files with 16 additions and 8 deletions

View File

@ -55,7 +55,7 @@
INSTANTIATE_SINGLETON_1(ScriptMgr);
ScriptMgr::ScriptMgr() : m_scheduledScripts(0)
ScriptMgr::ScriptMgr() : m_scheduledScripts(0), m_lock(0)
{
m_dbScripts.resize(DBS_END);
@ -70,6 +70,16 @@ ScriptMgr::~ScriptMgr()
m_dbScripts.clear();
}
ScriptChainMap const* ScriptMgr::GetScriptChainMap(DBScriptType type)
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, _guard, m_lock, NULL)
if ((type != DBS_INTERNAL) && type < DBS_END)
return &m_dbScripts[type];
return NULL;
}
// /////////////////////////////////////////////////////////
// DB SCRIPTS (loaders of static data)
// /////////////////////////////////////////////////////////

View File

@ -30,6 +30,8 @@
#include "ObjectGuid.h"
#include "DBCEnums.h"
#include <ace/Atomic_Op.h>
#include <ace/Thread_Mutex.h>
#include <ace/Guard_T.h>
struct AreaTriggerEntry;
struct SpellEntry;
@ -574,13 +576,7 @@ class ScriptMgr
bool ReloadScriptBinding();
ScriptChainMap const* GetScriptChainMap(DBScriptType type)
{
if ((type != DBS_INTERNAL) && type < DBS_END)
return &m_dbScripts[type];
return NULL;
}
ScriptChainMap const* GetScriptChainMap(DBScriptType type);
const char* GetScriptName(uint32 id) const
{
@ -668,6 +664,8 @@ class ScriptMgr
#endif /* _DEBUG */
// atomic op counter for active scripts amount
ACE_Atomic_Op<ACE_Thread_Mutex, long> m_scheduledScripts;
char __cache_guard[1024];
ACE_Thread_Mutex m_lock;
};
// Starters for events