diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 2962028a1..79f1701df 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -14,26 +14,21 @@ bool _SpellScript::_Validate(SpellInfo const* entry) { if (!Validate(entry)) { - LOG_ERROR("server", "_SpellScript::_Validate: Spell `%u` did not pass Validate() function of script `%s` - script will not be added to the spell", entry->Id, m_scriptName->c_str()); + LOG_ERROR("scripts.spells", "_SpellScript::_Validate: Spell `%u` did not pass Validate() function of script `%s` - script will not be added to the spell", entry->Id, m_scriptName->c_str()); return false; } return true; } -bool _SpellScript::_ValidateSpellInfo(uint32 const* begin, uint32 const* end) +bool _SpellScript::_ValidateSpellInfo(uint32 spellId) { - bool allValid = true; - while (begin != end) + if (!sSpellMgr->GetSpellInfo(spellId)) { - if (!sSpellMgr->GetSpellInfo(*begin)) - { - LOG_ERROR("server", "_SpellScript::_ValidateSpellInfo: Spell %u does not exist.", *begin); - allValid = false; - } - - ++begin; + LOG_ERROR("scripts.spells", "_SpellScript::ValidateSpellInfo: Spell %u does not exist.", spellId); + return false; } - return allValid; + + return true; } void _SpellScript::_Register() diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 1652460f1..97fa2acc6 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -123,7 +123,23 @@ public: } private: - static bool _ValidateSpellInfo(uint32 const* begin, uint32 const* end); + template + static bool _ValidateSpellInfo(Iterator begin, Iterator end) + { + bool allValid = true; + while (begin != end) + { + if (!_ValidateSpellInfo(*begin)) + { + allValid = false; + } + + ++begin; + } + return allValid; + } + + static bool _ValidateSpellInfo(uint32 spellId); }; // SpellScript interface - enum used for runtime checks of script function calls