[8381] Some refactoring work in Unit::m_currentSpells code. Author: VladimirMangos

* Restrict access, use enum args, move some repeated code parts to function.
    * Make m_selfContainer set only part of Unit::SetCurrentCastedSpell

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-19 16:52:51 -05:00
parent 6181620520
commit 012d6fa865
11 changed files with 87 additions and 86 deletions

View File

@@ -486,11 +486,11 @@ struct TRINITY_DLL_DECL boss_essence_of_desireAI : public ScriptedAI
void SpellHit(Unit *caster, const SpellEntry *spell)
{
if (m_creature->m_currentSpells[CURRENT_GENERIC_SPELL])
if (m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL))
for(uint8 i = 0; i < 3; ++i)
if (spell->Effect[i] == SPELL_EFFECT_INTERRUPT_CAST)
if (m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == SPELL_SOUL_SHOCK
|| m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == SPELL_DEADEN)
if (m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK
|| m_creature->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN)
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL, false);
}

View File

@@ -686,7 +686,7 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI
void CastChanneling()
{
if (!m_creature->isInCombat() && !m_creature->m_currentSpells[CURRENT_CHANNELED_SPELL])
if (!m_creature->isInCombat() && !m_creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
if (leotherasGUID)
{
@@ -745,7 +745,7 @@ struct TRINITY_DLL_DECL mob_greyheart_spellbinderAI : public ScriptedAI
{
bool isCasting = false;
for(uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
if (i_pl->m_currentSpells[i])
if (i_pl->GetCurrentSpell(i))
isCasting = true;
if (isCasting)