mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Scripts/Spells: Modernize spell script internals a bit - this makes Prepare macros unneccessary
This commit is contained in:
@@ -1350,8 +1350,8 @@ void ScriptMgr::FillSpellSummary()
|
||||
UnitAI::FillAISpellInfo();
|
||||
}
|
||||
|
||||
template<typename T, typename F, typename O>
|
||||
void CreateSpellOrAuraScripts(uint32 spellId, std::vector<T*>& scriptVector, F&& extractor, O* objectInvoker)
|
||||
template<typename T, typename O>
|
||||
void CreateSpellOrAuraScripts(uint32 spellId, std::vector<T*>& scriptVector, T*(SpellScriptLoader::*extractor)() const, O* objectInvoker)
|
||||
{
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId);
|
||||
for (auto itr = bounds.first; itr != bounds.second; ++itr)
|
||||
@@ -1364,11 +1364,11 @@ void CreateSpellOrAuraScripts(uint32 spellId, std::vector<T*>& scriptVector, F&&
|
||||
if (!tmpscript)
|
||||
continue;
|
||||
|
||||
T* script = (*tmpscript.*extractor)();
|
||||
T* script = (tmpscript->*extractor)();
|
||||
if (!script)
|
||||
continue;
|
||||
|
||||
script->_Init(&tmpscript->GetName(), spellId);
|
||||
script->_Init(tmpscript->GetName(), spellId);
|
||||
if (!script->_Load(objectInvoker))
|
||||
{
|
||||
delete script;
|
||||
|
||||
Reference in New Issue
Block a user