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:
yehonal
2018-02-28 20:20:10 +01:00
parent b9e122dfdf
commit 93cf5edd57
3 changed files with 89 additions and 73 deletions

View File

@@ -1017,6 +1017,15 @@ class GlobalScript : public ScriptObject
virtual void OnBeforeUpdateArenaPoints(ArenaTeam* /*at*/, std::map<uint32, uint32> & /*ap*/) { }
};
// this class can be used to be extended by Modules
// creating their own custom hooks inside module itself
class ModuleScript : public ScriptObject
{
protected:
ModuleScript(const char* name);
};
// Placed here due to ScriptRegistry::AddScript dependency.
#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
@@ -1460,4 +1469,9 @@ class ScriptRegistry
static uint32 _scriptIdCounter;
};
// Instantiate static members of ScriptRegistry.
template<class TScript> std::map<uint32, TScript*> ScriptRegistry<TScript>::ScriptPointerList;
template<class TScript> std::vector<TScript*> ScriptRegistry<TScript>::ALScripts;
template<class TScript> uint32 ScriptRegistry<TScript>::_scriptIdCounter = 0;
#endif