[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

@@ -325,8 +325,8 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
// Skip it to prevent "interrupt" message
if (IsAutoRepeatRangedSpell(spellInfo) && _player->m_currentSpells[CURRENT_AUTOREPEAT_SPELL]
&& _player->m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo == spellInfo)
if (IsAutoRepeatRangedSpell(spellInfo) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
&& _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
return;
// can't use our own spells when we're in possession of another unit,
@@ -381,9 +381,9 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
// channeled spell case (it currently casted then)
if (IsChanneledSpell(spellInfo))
{
if (_player->m_currentSpells[CURRENT_CHANNELED_SPELL] &&
_player->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spellId)
_player->InterruptSpell(CURRENT_CHANNELED_SPELL);
if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (curSpell->m_spellInfo->Id==spellId)
_player->InterruptSpell(CURRENT_CHANNELED_SPELL);
return;
}