Core/Spells: codestyle and fix logic for adding unit state casting. (thx Moriquendu)

This commit is contained in:
Kandera
2012-06-08 08:56:56 -04:00
parent 32aa983fe2
commit 643b68926e
2 changed files with 50 additions and 49 deletions
+8 -7
View File
@@ -2893,10 +2893,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
m_AutoRepeatFirstCast = true;
}
if ((m_currentSpells[CURRENT_GENERIC_SPELL] && m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true))
if ((pSpell->m_spellInfo->CalcCastTime(this) > 0) && IsNonMeleeSpellCasted(false, false, true))
AddUnitState(UNIT_STATE_CASTING);
} break;
break;
}
case CURRENT_CHANNELED_SPELL:
{
// channel spells always break generic non-delayed and any channeled spells
@@ -2908,8 +2909,9 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
AddUnitState(UNIT_STATE_CASTING);
} break;
break;
}
case CURRENT_AUTOREPEAT_SPELL:
{
// only Auto Shoot does not break anything
@@ -2921,12 +2923,11 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
}
// special action: set first cast flag
m_AutoRepeatFirstCast = true;
} break;
break;
}
default:
{
// other spell types don't break anything now
} break;
break; // other spell types don't break anything now
}
// current spell (if it is still here) may be safely deleted now