aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-14 21:06:45 -0500
committermegamage <none@none>2009-06-14 21:06:45 -0500
commitd86194147741840cbf4642d7a23003dc0f5bbb2b (patch)
treead7a55eaf2845eb41f80c62a5268c7e2810e9b83 /src
parent46ab948fe5ddb49ef3489fdb9114ea73a78f30bc (diff)
*Remove some redundent code in spell.cpp
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp1
-rw-r--r--src/game/Spell.cpp34
-rw-r--r--src/game/TemporarySummon.cpp3
3 files changed, 22 insertions, 16 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 54c86fa874a..7abe7f67d55 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1654,7 +1654,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// reset movement flags at teleport, because player will continue move with these flags after teleport
SetUnitMovementFlags(0);
- m_movementInfo.flags = 0;
if (m_transport)
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 87be2d381c2..0f2def62271 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1410,12 +1410,20 @@ bool Spell::UpdateChanneledTargetList()
uint8 needAliveTargetMask = m_needAliveTargetMask;
uint8 needAuraMask = 0;
- 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)
needAuraMask |= 1<<i;
needAuraMask &= needAliveTargetMask;
+ float range;
+ if(needAuraMask)
+ {
+ range = GetSpellMaxRange(m_spellInfo, IsPositiveSpell(m_spellInfo->Id));
+ if(Player * modOwner = m_caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
+ }
+
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
@@ -1428,9 +1436,6 @@ bool Spell::UpdateChanneledTargetList()
{
if(Aura * aur = unit->GetAura(m_spellInfo->Id, m_originalCasterGUID))
{
- float range = m_caster->GetSpellMaxRangeForTarget(unit,GetSpellRangeStore()->LookupEntry(m_spellInfo->rangeIndex));
- if(Player * modOwner = m_caster->GetSpellModOwner())
- modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit,range))
{
ihit->effectMask &= ~aur->GetEffectMask();
@@ -1438,7 +1443,7 @@ bool Spell::UpdateChanneledTargetList()
continue;
}
}
- else
+ else // aura is dispelled
continue;
}
@@ -2520,16 +2525,12 @@ void Spell::cancel()
case SPELL_STATE_CASTING:
{
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
- {
- if( ihit->missCondition == SPELL_MISS_NONE )
- {
- Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
- if( unit && unit->isAlive() )
- unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
- }
- }
- m_caster->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ if(ihit->missCondition == SPELL_MISS_NONE)
+ if(Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
+ if(unit->isAlive())
+ unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
+
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@@ -2912,6 +2913,7 @@ void Spell::update(uint32 difftime)
if(m_targets.getUnitTargetGUID() && !m_targets.getUnitTarget())
{
+ sLog.outDebug("Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
cancel();
return;
}
@@ -5934,6 +5936,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
{
// no, we aren't, do the typical update
// check, if we have channeled spell on our hands
+ /*
if (IsChanneledSpell(m_Spell->m_spellInfo))
{
// evented channeled spell is processed separately, casted once after delay, and not destroyed till finish
@@ -5956,6 +5959,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// event will be re-added automatically at the end of routine)
}
else
+ */
{
// run the spell handler and think about what we can do next
uint64 t_offset = e_time - m_Spell->GetDelayStart();
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index b481afb4bce..724d68c568b 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -345,7 +345,10 @@ void Puppet::Update(uint32 time)
if(IsInWorld())
{
if(!isAlive())
+ {
UnSummon();
+ // TODO: why long distance .die does not remove it
+ }
}
}