diff options
| author | megamage <none@none> | 2009-08-31 00:14:45 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-08-31 00:14:45 -0500 |
| commit | f5d4ee1e9535326993e33c7088804d846494d8f9 (patch) | |
| tree | 327dd74355129f37275e375bb80a0e8a65c8a9e2 /src/game/Spell.cpp | |
| parent | 9b0c7129465bfc98e13d6f7b0596d1e0c089ef01 (diff) | |
*Fix a crash caused by unremoved spell mode. Thanks to Visagalis
--HG--
branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
| -rw-r--r-- | src/game/Spell.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3eada04fe42..64758d62f94 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2814,6 +2814,7 @@ void Spell::cast(bool skipCheck) if (m_caster->GetTypeId()==TYPEID_PLAYER) { // Set spell which will drop charges for triggered cast spells + // if not successfully casted, will be remove in finish(false) ((Player*)m_caster)->SetSpellModTakingSpell(this, true); } @@ -2825,6 +2826,14 @@ void Spell::cast(bool skipCheck) { SendCastResult(castResult); SendInterrupted(0); + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + ((Player*)m_caster)->RestoreSpellMods(this); + // cleanup after mod system + // triggered spell pointer can be not removed in some cases + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + } finish(false); SetExecutedCurrently(false); return; @@ -2837,6 +2846,15 @@ void Spell::cast(bool skipCheck) if(m_spellState == SPELL_STATE_FINISHED) { SendInterrupted(0); + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + ((Player*)m_caster)->RestoreSpellMods(this); + // cleanup after mod system + // triggered spell pointer can be not removed in some cases + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + } + finish(false); SetExecutedCurrently(false); return; } @@ -3046,6 +3064,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) } } + if (m_caster->GetTypeId()==TYPEID_PLAYER) + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + // All targets passed - need finish phase if (next_time == 0) { @@ -3059,9 +3080,6 @@ uint64 Spell::handle_delayed(uint64 t_offset) } else { - if (m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->SetSpellModTakingSpell(this, false); - // spell is unfinished, return next execution time return next_time; } @@ -3315,17 +3333,7 @@ void Spell::finish(bool ok) } if(!ok) - { - //restore spell mods - if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - ((Player*)m_caster)->RestoreSpellMods(this); - // cleanup after mod system - // triggered spell pointer can be not removed in some cases - ((Player*)m_caster)->SetSpellModTakingSpell(this, false); - } return; - } if (m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isSummon()) { |
