Merge pull request #106 from H0zen/develop21
Fix previous dbscripts commit.
This commit is contained in:
commit
2a866d08c1
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
INSTANTIATE_SINGLETON_1(ScriptMgr);
|
INSTANTIATE_SINGLETON_1(ScriptMgr);
|
||||||
|
|
||||||
ScriptMgr::ScriptMgr() : m_scheduledScripts(0)
|
ScriptMgr::ScriptMgr() : m_scheduledScripts(0), m_lock(0)
|
||||||
{
|
{
|
||||||
m_dbScripts.resize(DBS_END);
|
m_dbScripts.resize(DBS_END);
|
||||||
|
|
||||||
@ -70,6 +70,16 @@ ScriptMgr::~ScriptMgr()
|
|||||||
m_dbScripts.clear();
|
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)
|
// DB SCRIPTS (loaders of static data)
|
||||||
// /////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////
|
||||||
@ -738,12 +748,17 @@ void ScriptMgr::LoadScripts(DBScriptType type)
|
|||||||
|
|
||||||
void ScriptMgr::LoadDbScripts(DBScriptType t)
|
void ScriptMgr::LoadDbScripts(DBScriptType t)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::set<uint32> eventIds; // Store possible event ids
|
std::set<uint32> eventIds; // Store possible event ids
|
||||||
|
|
||||||
if (t == DBS_ON_EVENT)
|
if (t == DBS_ON_EVENT)
|
||||||
CollectPossibleEventIds(eventIds);
|
CollectPossibleEventIds(eventIds);
|
||||||
|
|
||||||
LoadScripts(t);
|
{
|
||||||
|
ACE_GUARD(ACE_Thread_Mutex, _g, m_lock)
|
||||||
|
LoadScripts(t);
|
||||||
|
}
|
||||||
|
|
||||||
ScriptChainMap& scm = m_dbScripts[t];
|
ScriptChainMap& scm = m_dbScripts[t];
|
||||||
|
|
||||||
for (ScriptChainMap::const_iterator itr = scm.begin(); itr != scm.end(); ++itr)
|
for (ScriptChainMap::const_iterator itr = scm.begin(); itr != scm.end(); ++itr)
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "DBCEnums.h"
|
#include "DBCEnums.h"
|
||||||
#include <ace/Atomic_Op.h>
|
#include <ace/Atomic_Op.h>
|
||||||
|
#include <ace/Thread_Mutex.h>
|
||||||
|
#include <ace/Guard_T.h>
|
||||||
|
|
||||||
struct AreaTriggerEntry;
|
struct AreaTriggerEntry;
|
||||||
struct SpellEntry;
|
struct SpellEntry;
|
||||||
@ -574,13 +576,7 @@ class ScriptMgr
|
|||||||
|
|
||||||
bool ReloadScriptBinding();
|
bool ReloadScriptBinding();
|
||||||
|
|
||||||
ScriptChainMap const* GetScriptChainMap(DBScriptType type)
|
ScriptChainMap const* GetScriptChainMap(DBScriptType type);
|
||||||
{
|
|
||||||
if ((type != DBS_INTERNAL) && type < DBS_END)
|
|
||||||
return &m_dbScripts[type];
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* GetScriptName(uint32 id) const
|
const char* GetScriptName(uint32 id) const
|
||||||
{
|
{
|
||||||
@ -668,6 +664,8 @@ class ScriptMgr
|
|||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
// atomic op counter for active scripts amount
|
// atomic op counter for active scripts amount
|
||||||
ACE_Atomic_Op<ACE_Thread_Mutex, long> m_scheduledScripts;
|
ACE_Atomic_Op<ACE_Thread_Mutex, long> m_scheduledScripts;
|
||||||
|
char __cache_guard[1024];
|
||||||
|
ACE_Thread_Mutex m_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Starters for events
|
// Starters for events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user