[c12643] Correct logic when setting SPELL_FLAG_REDIRECTED

This commit is contained in:
Dramacydal 2013-06-17 10:52:52 +01:00 committed by Antz
parent c3eccda44d
commit b835736923
2 changed files with 12 additions and 6 deletions

View file

@ -1894,12 +1894,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
if (EffectChainTarget <= 1) if (EffectChainTarget <= 1)
{ {
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex))
{
if (m_targets.getUnitTarget() != pUnitTarget)
{ {
m_targets.setUnitTarget(pUnitTarget); m_targets.setUnitTarget(pUnitTarget);
m_spellFlags |= SPELL_FLAG_REDIRECTED; m_spellFlags |= SPELL_FLAG_REDIRECTED;
targetUnitMap.push_back(pUnitTarget); targetUnitMap.push_back(pUnitTarget);
} }
} }
}
else else
{ {
Unit* pUnitTarget = m_targets.getUnitTarget(); Unit* pUnitTarget = m_targets.getUnitTarget();
@ -2458,9 +2461,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
case TARGET_SINGLE_ENEMY: case TARGET_SINGLE_ENEMY:
{ {
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex))
{
if (m_targets.getUnitTarget() != pUnitTarget)
{ {
m_targets.setUnitTarget(pUnitTarget); m_targets.setUnitTarget(pUnitTarget);
m_spellFlags |= SPELL_FLAG_REDIRECTED; m_spellFlags |= SPELL_FLAG_REDIRECTED;
}
targetUnitMap.push_back(pUnitTarget); targetUnitMap.push_back(pUnitTarget);
} }
break; break;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12642" #define REVISION_NR "12643"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__