diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index a4d975296..c6e7e6372 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -395,6 +395,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_castPositionX = m_castPositionY = m_castPositionZ = 0; m_TriggerSpells.clear(); + m_preCastSpells.clear(); m_IsTriggeredSpell = triggered; //m_AreaAura = false; m_CastItem = NULL; @@ -405,7 +406,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi focusObject = NULL; m_cast_count = 0; m_glyphIndex = 0; - m_preCastSpells = NULL; m_triggeredByAuraSpell = NULL; //Auto Shot & Shoot (wand) @@ -445,7 +445,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi Spell::~Spell() { - delete m_preCastSpells; } template @@ -1239,12 +1238,11 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) unit->IncrDiminishing(m_diminishGroup); // Apply additional spell effects to target - if (m_preCastSpells) + while (!m_preCastSpells.empty()) { - for (SpellPrecasts::const_iterator i = m_preCastSpells->begin(); i != m_preCastSpells->end(); ++i) - m_caster->CastSpell(unit, *i, true, m_CastItem); - delete m_preCastSpells; - m_preCastSpells = NULL; + uint32 spellId = *m_preCastSpells.begin(); + m_caster->CastSpell(unit, spellId, true, m_CastItem); + m_preCastSpells.erase(m_preCastSpells.begin()); } for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) diff --git a/src/game/Spell.h b/src/game/Spell.h index 3583f546a..d3b587e95 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -204,7 +204,6 @@ enum SpellTargets #define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS) typedef std::multimap SpellTargetTimeMap; -typedef std::list SpellPrecasts; class Spell { @@ -336,13 +335,6 @@ class Spell void TakeCastItem(); void TriggerSpell(); - void AddPrecastSpell(uint32 spellId) - { - if (!m_preCastSpells) - m_preCastSpells = new SpellPrecasts(); - m_preCastSpells->push_back(spellId); - } - SpellCastResult CheckCast(bool strict); SpellCastResult CheckPetCast(Unit* target); @@ -407,7 +399,6 @@ class Spell Item* m_CastItem; uint8 m_cast_count; uint32 m_glyphIndex; - SpellPrecasts *m_preCastSpells; SpellCastTargets m_targets; int32 GetCastTime() const { return m_casttime; } @@ -448,6 +439,7 @@ class Spell bool CheckTargetCreatureType(Unit* target) const; void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); } + void AddPrecastSpell(uint32 spellId) { m_preCastSpells.push_back(spellId); } void CleanupTargetList(); protected: @@ -567,7 +559,9 @@ class Spell //List For Triggered Spells typedef std::list TriggerSpells; + typedef std::list SpellPrecasts; TriggerSpells m_TriggerSpells; + SpellPrecasts m_preCastSpells; uint32 m_spellState; uint32 m_timer; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8f4e615d1..652bc3566 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8141" + #define REVISION_NR "8142" #endif // __REVISION_NR_H__