From 1760e42e2caa99d3de0038d1b52f64a1daeb665a Mon Sep 17 00:00:00 2001 From: QAston Date: Fri, 8 Oct 2010 21:33:44 +0200 Subject: Core/ScriptSystem: Add compile time type check of function assigned to hooks - prevents incorrect function calls. Since this rev you have to put PrepareSpellScript() at the beginning of every spell script. Yes, i know it's unhandy, but unfortunately C++ preprocessor is very limited, so you have to do that extra work each time you write a script:(. --HG-- branch : trunk --- src/server/game/Spells/SpellScript.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/server/game/Spells/SpellScript.cpp') diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 355da664f42..ee2c7836f62 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -167,6 +167,16 @@ void SpellScript::EffectHandler::Call(SpellScript * spellScript, SpellEffIndex e (spellScript->*pEffectHandlerScript)(effIndex); } +SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript) +{ + pHitHandlerScript = _pHitHandlerScript; +} + +void SpellScript::HitHandler::Call(SpellScript * spellScript) +{ + (spellScript->*pHitHandlerScript)(); +} + bool SpellScript::_Validate(SpellEntry const * entry) { for (std::list::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr) -- cgit v1.2.3