[11259] Move scheduled scripts counter to ScriptMgr

Also cleanup forward declarations.
This commit is contained in:
zergtmn 2011-03-16 20:01:03 +05:00
parent dee6d712c4
commit a6d155fc54
9 changed files with 33 additions and 33 deletions

View file

@ -23,6 +23,7 @@
#include "Policies/Singleton.h"
#include "ObjectGuid.h"
#include "DBCEnums.h"
#include "ace/Atomic_Op.h"
struct AreaTriggerEntry;
class Aura;
@ -297,6 +298,7 @@ struct ScriptAction
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
typedef std::map<uint32, ScriptMap > ScriptMapMap;
extern ScriptMapMap sQuestEndScripts;
extern ScriptMapMap sQuestStartScripts;
extern ScriptMapMap sSpellScripts;
@ -343,6 +345,11 @@ class ScriptMgr
void UnloadScriptLibrary();
bool IsScriptLibraryLoaded() const { return m_hScriptLib != NULL; }
uint32 IncreaseScheduledScriptsCount() { return (uint32)++m_scheduledScripts; }
uint32 DecreaseScheduledScriptCount() { return (uint32)--m_scheduledScripts; }
uint32 DecreaseScheduledScriptCount(size_t count) { return (uint32)(m_scheduledScripts -= count); }
bool IsScriptScheduled() const { return m_scheduledScripts > 0; }
CreatureAI* GetCreatureAI(Creature* pCreature);
InstanceData* CreateInstanceData(Map* pMap);
@ -387,6 +394,9 @@ class ScriptMgr
ScriptNameMap m_scriptNames;
MANGOS_LIBRARY_HANDLE m_hScriptLib;
//atomic op counter for active scripts amount
ACE_Atomic_Op<ACE_Thread_Mutex, long> m_scheduledScripts;
void (MANGOS_IMPORT* m_pOnInitScriptLibrary)();
void (MANGOS_IMPORT* m_pOnFreeScriptLibrary)();
const char* (MANGOS_IMPORT* m_pGetScriptLibraryVersion)();