mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
Moved ScriptMgr macros to separated header and created ModuleScript
it will allow Modules to create their own Hooks inside the module itself, to customize/extend their functionalities. An example of its usage will be available in VAS Module: You'll be able to disable VAS with custom conditions from other modules.
This commit is contained in:
35
src/server/game/Scripting/ScriptMgrMacros.h
Normal file
35
src/server/game/Scripting/ScriptMgrMacros.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
// Utility macros to refer to the script registry.
|
||||
#define SCR_REG_MAP(T) ScriptRegistry<T>::ScriptMap
|
||||
#define SCR_REG_ITR(T) ScriptRegistry<T>::ScriptMapIterator
|
||||
#define SCR_REG_LST(T) ScriptRegistry<T>::ScriptPointerList
|
||||
|
||||
// Utility macros for looping over scripts.
|
||||
#define FOR_SCRIPTS(T, C, E) \
|
||||
if (!SCR_REG_LST(T).empty()) \
|
||||
for (SCR_REG_ITR(T) C = SCR_REG_LST(T).begin(); \
|
||||
C != SCR_REG_LST(T).end(); ++C)
|
||||
#define FOR_SCRIPTS_RET(T, C, E, R) \
|
||||
if (SCR_REG_LST(T).empty()) \
|
||||
return R; \
|
||||
for (SCR_REG_ITR(T) C = SCR_REG_LST(T).begin(); \
|
||||
C != SCR_REG_LST(T).end(); ++C)
|
||||
#define FOREACH_SCRIPT(T) \
|
||||
FOR_SCRIPTS(T, itr, end) \
|
||||
itr->second
|
||||
|
||||
// Utility macros for finding specific scripts.
|
||||
#define GET_SCRIPT(T, I, V) \
|
||||
T* V = ScriptRegistry<T>::GetScriptById(I); \
|
||||
if (!V) \
|
||||
return;
|
||||
#define GET_SCRIPT_RET(T, I, V, R) \
|
||||
T* V = ScriptRegistry<T>::GetScriptById(I); \
|
||||
if (!V) \
|
||||
return R;
|
||||
|
||||
Reference in New Issue
Block a user