aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp16
-rw-r--r--src/game/SpellAuras.h6
-rw-r--r--src/game/Unit.cpp8
3 files changed, 13 insertions, 17 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 98ca443b8e8..d34a1bdda03 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -456,10 +456,9 @@ Aura::~Aura()
AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit *caster, Item* castItem, WorldObject *source) :
m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
m_target(parentAura->GetTarget()), m_tickNumber(0)
+, m_spellProto(parentAura->GetSpellProto()), m_effIndex(effIndex), m_auraName(AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]))
{
- m_spellProto = parentAura->GetSpellProto();
- m_effIndex = effIndex;
- m_auraName = AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]);
+ assert(m_auraName < TOTAL_AURAS);
if(currentBasePoints)
m_currentBasePoints = *currentBasePoints;
@@ -533,12 +532,12 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
m_areaAuraType = AREA_AURA_PARTY;
if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
- m_auraName = SPELL_AURA_NONE;
+ const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
m_areaAuraType = AREA_AURA_RAID;
if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
- m_auraName = SPELL_AURA_NONE;
+ const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
m_areaAuraType = AREA_AURA_FRIEND;
@@ -546,7 +545,7 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
m_areaAuraType = AREA_AURA_ENEMY;
if(m_target == caster_ptr)
- m_auraName = SPELL_AURA_NONE; // Do not do any effect on self
+ const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE; // Do not do any effect on self
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
m_areaAuraType = AREA_AURA_PET;
@@ -554,7 +553,7 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
m_areaAuraType = AREA_AURA_OWNER;
if(m_target == caster_ptr)
- m_auraName = SPELL_AURA_NONE;
+ const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break;
default:
sLog.outError("Wrong spell effect in AreaAura constructor");
@@ -856,8 +855,7 @@ void AuraEffect::ApplyModifier(bool apply, bool Real, bool changeAmount)
if (GetParentAura()->IsRemoved())
return;
- if(m_auraName<TOTAL_AURAS)
- (*this.*AuraHandler [m_auraName])(apply,Real, changeAmount);
+ (*this.*AuraHandler [m_auraName])(apply,Real, changeAmount);
}
void AuraEffect::RecalculateAmount(bool applied)
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 20d27e915c1..579794e3da2 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -377,11 +377,11 @@ class TRINITY_DLL_SPEC AuraEffect
Unit * const m_target;
uint64 m_sourceGUID; // Spell::m_caster/trap? for normal aura, totem/paladin for areaaura, dynobj for persistent aura
- SpellEntry const *m_spellProto;
uint32 m_tickNumber;
- uint8 m_effIndex;
- AuraType m_auraName;
+ const SpellEntry * const m_spellProto;
+ const uint8 m_effIndex;
+ const AuraType m_auraName;
int32 m_currentBasePoints;
int32 m_amount;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index dd589023c47..a39b43a88a7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4099,7 +4099,6 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except)
{
- if (auraType >= TOTAL_AURAS) return;
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{
Aura * aur = (*iter)->GetParentAura();
@@ -4116,7 +4115,6 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except
void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
{
- if (auraType >= TOTAL_AURAS) return;
std::queue < std::pair < uint32, uint64 > > remove_list;
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();++iter)
@@ -11999,10 +11997,10 @@ typedef std::list< ProcTriggeredData > ProcTriggeredList;
// for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic
bool InitTriggerAuraData()
{
- for (int i=0;i<TOTAL_AURAS;i++)
+ for (int i = 0; i < TOTAL_AURAS; ++i)
{
- isTriggerAura[i]=false;
- isNonTriggerAura[i] = false;
+ isTriggerAura[i]=false;
+ isNonTriggerAura[i] = false;
}
isTriggerAura[SPELL_AURA_DUMMY] = true;
isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true;