mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8142] Remade precast spell system to be more similar to trigger spell system.
* Removed runtime allocation of list * Methods and defines from precast spell system and trigger system moved closer to each other Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
42300153ce
commit
5d4b581009
3 changed files with 9 additions and 17 deletions
|
|
@ -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<typename T>
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ enum SpellTargets
|
|||
#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS)
|
||||
|
||||
typedef std::multimap<uint64, uint64> SpellTargetTimeMap;
|
||||
typedef std::list<uint32> 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<SpellEntry const*> TriggerSpells;
|
||||
typedef std::list<uint32> SpellPrecasts;
|
||||
TriggerSpells m_TriggerSpells;
|
||||
SpellPrecasts m_preCastSpells;
|
||||
|
||||
uint32 m_spellState;
|
||||
uint32 m_timer;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8141"
|
||||
#define REVISION_NR "8142"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue