aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-30 10:46:14 -0700
committermaximius <none@none>2009-10-30 10:46:14 -0700
commit1134fd99f08633dff09822efef99f80c1c6107d9 (patch)
tree74afcccf66cba087e8aca4d3be41f32cf9c3d332
parentf4f19ac255af296d71a5bb4b97411ae79727fcb3 (diff)
*Target is never valid on MAPID_INVALID.
--HG-- branch : trunk
-rw-r--r--src/game/Spell.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 99056c43772..f60676dd208 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2558,14 +2558,14 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura)
{
- if(m_CastItem)
+ if (m_CastItem)
m_castItemGUID = m_CastItem->GetGUID();
else
m_castItemGUID = 0;
m_targets = *targets;
- if(!m_targets.getUnitTargetGUID() && m_spellInfo->Targets & TARGET_FLAG_UNIT)
+ if (!m_targets.getUnitTargetGUID() && m_spellInfo->Targets & TARGET_FLAG_UNIT)
{
Unit *target = NULL;
if(m_caster->GetTypeId() == TYPEID_UNIT)
@@ -2573,7 +2573,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
else
target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
- if(target && IsValidSingleTargetSpell(target))
+ if (target && IsValidSingleTargetSpell(target))
m_targets.setUnitTarget(target);
else
{
@@ -2586,7 +2586,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
// Fill aura scaling information
if (m_caster->IsControlledByPlayer() && !IsPassiveSpell(m_spellInfo->Id) && m_spellInfo->spellLevel && !IsChanneledSpell(m_spellInfo) && !m_IsTriggeredSpell)
{
- for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
@@ -6350,7 +6350,9 @@ bool SpellEvent::IsDeletable() const
bool Spell::IsValidSingleTargetEffect(Unit const* target, Targets type) const
{
- switch(type)
+ if (target->GetMapId() == MAPID_INVALID)
+ return false;
+ switch (type)
{
case TARGET_UNIT_TARGET_ENEMY:
return !m_caster->IsFriendlyTo(target);