diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 56 | ||||
-rw-r--r-- | src/game/Spell.h | 2 |
2 files changed, 30 insertions, 28 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 622ca263adf..9c9fde63796 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1431,34 +1431,38 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, const uint32 type, SpellTargets TargetType, uint32 entry) { float x, y, z; - if(type == PUSH_DST_CENTER) - { - if(!m_targets.HasDst()) - { - sLog.outError( "SPELL: cannot find destination for spell ID %u\n", m_spellInfo->Id ); - return; - } - x = m_targets.m_destX; - y = m_targets.m_destY; - z = m_targets.m_destZ; - } - else if(type == PUSH_CHAIN) + switch(type) { - Unit *target = m_targets.getUnitTarget(); - if(!target) + case PUSH_DST_CENTER: + CheckDst(); + x = m_targets.m_destX; + y = m_targets.m_destY; + z = m_targets.m_destZ; + break; + case PUSH_SRC_CENTER: + CheckSrc(); + x = m_targets.m_srcX; + y = m_targets.m_srcY; + z = m_targets.m_srcZ; + break; + case PUSH_CHAIN: { - sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id ); - return; + Unit *target = m_targets.getUnitTarget(); + if(!target) + { + sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id ); + return; + } + x = target->GetPositionX(); + y = target->GetPositionY(); + z = target->GetPositionZ(); + break; } - x = target->GetPositionX(); - y = target->GetPositionY(); - z = target->GetPositionZ(); - } - else - { - x = m_caster->GetPositionX(); - y = m_caster->GetPositionY(); - z = m_caster->GetPositionZ(); + default: + x = m_caster->GetPositionX(); + y = m_caster->GetPositionY(); + z = m_caster->GetPositionZ(); + break; } Trinity::SpellNotifierCreatureAndPlayer notifier(*this, TagUnitMap, radius, type, TargetType, entry, x, y, z); @@ -1672,12 +1676,10 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) } case TARGET_TYPE_AREA_SRC: - CheckSrc(); pushType = PUSH_SRC_CENTER; break; case TARGET_TYPE_AREA_DST: - CheckDst(); pushType = PUSH_DST_CENTER; break; diff --git a/src/game/Spell.h b/src/game/Spell.h index 346dc421e2d..94166425675 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -81,7 +81,7 @@ enum SpellNotifyPushType PUSH_IN_LINE, PUSH_SRC_CENTER, PUSH_DST_CENTER, - PUSH_CASTER_CENTER, + PUSH_CASTER_CENTER, //this is never used in grid search PUSH_CHAIN, }; |