diff options
author | megamage <none@none> | 2009-04-29 18:10:00 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-29 18:10:00 -0500 |
commit | 98cda7714641d56bdb16bc01fbc3be6dd59c1be1 (patch) | |
tree | 0a01ebf8d01959f20ff4ea211abeae1e9eba12c7 | |
parent | 59e79dfef08dc328a3b3ece1fa67c547c2d893e6 (diff) |
*Cleanup InterruptNonMeleeSpells. Backported from TC2. Source: Mangos.
--HG--
branch : trunk
-rw-r--r-- | src/game/Unit.cpp | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7b1ca779871..8d619f4922f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3485,40 +3485,16 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id) { // generic spells are interrupted if they are not finished or delayed - Spell *spell = m_currentSpells[CURRENT_GENERIC_SPELL]; - if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id)) - { - m_currentSpells[CURRENT_GENERIC_SPELL] = NULL; - - if ( (spell->getState() != SPELL_STATE_FINISHED) && - (withDelayed || spell->getState() != SPELL_STATE_DELAYED) ) - spell->cancel(); - spell->SetReferencedFromCurrent(false); - } + if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id)) + InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed); - spell = m_currentSpells[CURRENT_AUTOREPEAT_SPELL]; // autorepeat spells are interrupted if they are not finished or delayed - if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id)) - { - m_currentSpells[CURRENT_AUTOREPEAT_SPELL] = NULL; - // send disable autorepeat packet in any case - if(GetTypeId()==TYPEID_PLAYER) - ((Player*)this)->SendAutoRepeatCancel(); - if ( (spell->getState() != SPELL_STATE_FINISHED) && - (withDelayed || spell->getState() != SPELL_STATE_DELAYED) ) - spell->cancel(); - spell->SetReferencedFromCurrent(false); - } + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id)) + InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed); // channeled spells are interrupted if they are not finished, even if they are delayed - spell = m_currentSpells[CURRENT_CHANNELED_SPELL]; - if (spell && (!spell_id || spell->m_spellInfo->Id==spell_id)) - { - m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL; - if (spell->getState() != SPELL_STATE_FINISHED) - spell->cancel(); - spell->SetReferencedFromCurrent(false); - } + if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) + InterruptSpell(CURRENT_CHANNELED_SPELL,true); } Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const |