From 0d57b3c27320df09e230553f346d850f8bb43bcd Mon Sep 17 00:00:00 2001 From: Darron Lumley Date: Sat, 16 Sep 2017 09:20:37 +1000 Subject: [PATCH] Fixed spell casting destination to require ENABLE_LOGS and ENABLE_EXTRA_LOGS to be enabled (#601) --- src/game/Spells/Spell.cpp | 75 ++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 01f08b88e9..aacb1749bd 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -977,46 +977,49 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa return; } - switch (targetType.GetTarget()) - { - case TARGET_UNIT_CHANNEL_TARGET: - { - // Xinef: All channel selectors have needed data passed in m_targets structure - WorldObject* target = m_targets.GetObjectTargetChannel(m_caster); - if (target) - { - CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); - // unit target may be no longer avalible - teleported out of map for example - if (target && target->ToUnit()) - AddUnitTarget(target->ToUnit(), 1 << effIndex); - } - else + switch (targetType.GetTarget()) + { + case TARGET_UNIT_CHANNEL_TARGET: + { + // Xinef: All channel selectors have needed data passed in m_targets structure + WorldObject* target = m_targets.GetObjectTargetChannel(m_caster); + if (target) + { + CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); + // unit target may be no longer avalible - teleported out of map for example + if (target && target->ToUnit()) + AddUnitTarget(target->ToUnit(), 1 << effIndex); + } + else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); #endif - break; - } - case TARGET_DEST_CHANNEL_TARGET: - if (m_targets.HasDstChannel()) - m_targets.SetDst(*m_targets.GetDstChannel()); - else if (WorldObject* target = m_targets.GetObjectTargetChannel(m_caster)) - { - CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); - if (target) - m_targets.SetDst(*target); - } - else //if (!m_targets.HasDst()) + } + break; + } + case TARGET_DEST_CHANNEL_TARGET: + if (m_targets.HasDstChannel()) + m_targets.SetDst(*m_targets.GetDstChannel()); + else if (WorldObject* target = m_targets.GetObjectTargetChannel(m_caster)) + { + CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); + if (target) + m_targets.SetDst(*target); + } + else //if (!m_targets.HasDst()) + { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); #endif - break; - case TARGET_DEST_CHANNEL_CASTER: - if (GetOriginalCaster()) - m_targets.SetDst(*GetOriginalCaster()); - break; - default: - ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type"); - break; + } + break; + case TARGET_DEST_CHANNEL_CASTER: + if (GetOriginalCaster()) + m_targets.SetDst(*GetOriginalCaster()); + break; + default: + ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type"); + break; } }