aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.h
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-19 16:52:51 -0500
committermegamage <none@none>2009-08-19 16:52:51 -0500
commit012d6fa865fb8083dcbeae9b04926527b3c19f4e (patch)
tree46b2b2c30d751888d2dd91fc31c9bd0457790b7f /src/game/Unit.h
parent618162052007b3e9003db858ea33eed11f5af4df (diff)
[8381] Some refactoring work in Unit::m_currentSpells code. Author: VladimirMangos
* Restrict access, use enum args, move some repeated code parts to function. * Make m_selfContainer set only part of Unit::SetCurrentCastedSpell --HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.h')
-rw-r--r--src/game/Unit.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game/Unit.h b/src/game/Unit.h
index bb6b4262549..a0b371a2b7e 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -852,14 +852,16 @@ struct DeclinedName
enum CurrentSpellTypes
{
- CURRENT_MELEE_SPELL = 0,
- CURRENT_FIRST_NON_MELEE_SPELL = 1, // just counter
- CURRENT_GENERIC_SPELL = 1,
- CURRENT_AUTOREPEAT_SPELL = 2,
- CURRENT_CHANNELED_SPELL = 3,
- CURRENT_MAX_SPELL = 4 // just counter
+ CURRENT_MELEE_SPELL = 0,
+ CURRENT_GENERIC_SPELL = 1,
+ CURRENT_AUTOREPEAT_SPELL = 2,
+ CURRENT_CHANNELED_SPELL = 3
};
+#define CURRENT_FIRST_NON_MELEE_SPELL 1
+#define CURRENT_MAX_SPELL 4
+
+
enum ActiveStates
{
ACT_PASSIVE = 0x01, // 0x01 - passive
@@ -1490,7 +1492,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SetCurrentCastedSpell(Spell * pSpell);
virtual void ProhibitSpellScholl(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/ ) { }
- void InterruptSpell(uint32 spellType, bool withDelayed = true, bool withInstant = true);
+ void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true);
+ void FinishSpell(CurrentSpellTypes spellType, bool ok = true);
// set withDelayed to true to account delayed spells as casted
// delayed+channeled spells are always accounted as casted
@@ -1501,11 +1504,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// delayed+channeled spells are always interrupted
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true);
+ Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; }
+ Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; }
Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
int32 GetCurrentSpellCastTime(uint32 spell_id) const;
- Spell* m_currentSpells[CURRENT_MAX_SPELL];
-
uint32 m_addDmgOnce;
uint64 m_SummonSlot[MAX_SUMMON_SLOT];
uint64 m_ObjectSlot[4];
@@ -1907,6 +1910,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 m_CombatTimer;
uint32 m_lastManaUse; // msecs
+ Spell* m_currentSpells[CURRENT_MAX_SPELL];
+
UnitVisibility m_Visibility;
Diminishing m_Diminishing;