[10484] Use for auraholde/aura GetStackAmount uint32 result.

uint32 result used in most expressions for stack calculation/compare
Alos uint8implicitly casted to int by C++ in expressions that generate unexpected
signed/unsigned warnings in comparisons (uint8 +1) > uint32 and similar.
This commit is contained in:
VladimirMangos 2010-09-14 21:26:24 +04:00
parent a3e62d43b0
commit f0956e258c
5 changed files with 14 additions and 14 deletions

View file

@ -8136,15 +8136,15 @@ bool SpellAuraHolder::ModStackAmount(int32 num)
return false; return false;
} }
void SpellAuraHolder::SetStackAmount(uint8 stackAmount) void SpellAuraHolder::SetStackAmount(uint32 stackAmount)
{ {
Unit *target = GetTarget(); Unit *target = GetTarget();
Unit *caster = GetCaster(); Unit *caster = GetCaster();
if (!target || !caster) if (!target || !caster)
return; return;
bool refresh = stackAmount >= m_stackAmount; bool refresh = stackAmount >= uint32(m_stackAmount);
if (stackAmount != m_stackAmount) if (stackAmount != uint32(m_stackAmount))
{ {
m_stackAmount = stackAmount; m_stackAmount = stackAmount;

View file

@ -58,8 +58,8 @@ class MANGOS_DLL_SPEC SpellAuraHolder
void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; } void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; } DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
uint8 GetStackAmount() { return m_stackAmount; } uint32 GetStackAmount() { return m_stackAmount; }
void SetStackAmount(uint8 stackAmount); void SetStackAmount(uint32 stackAmount);
bool ModStackAmount(int32 num); // return true if last charge dropped bool ModStackAmount(int32 num); // return true if last charge dropped
Aura* GetAuraByEffectIndex(SpellEffectIndex index) const { return m_auras[index]; } Aura* GetAuraByEffectIndex(SpellEffectIndex index) const { return m_auras[index]; }
@ -389,7 +389,7 @@ class MANGOS_DLL_SPEC Aura
time_t GetAuraApplyTime() const { return m_applyTime; } time_t GetAuraApplyTime() const { return m_applyTime; }
uint32 GetAuraTicks() const { return m_periodicTick; } uint32 GetAuraTicks() const { return m_periodicTick; }
uint32 GetAuraMaxTicks() const { return m_maxduration > 0 && m_modifier.periodictime > 0 ? m_maxduration / m_modifier.periodictime : 0; } uint32 GetAuraMaxTicks() const { return m_maxduration > 0 && m_modifier.periodictime > 0 ? m_maxduration / m_modifier.periodictime : 0; }
uint8 GetStackAmount() const { return GetHolder()->GetStackAmount(); } uint32 GetStackAmount() const { return GetHolder()->GetStackAmount(); }
void SetLoadedState(int32 damage,int32 maxduration,int32 duration) void SetLoadedState(int32 damage,int32 maxduration,int32 duration)
{ {

View file

@ -1691,7 +1691,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
if (Aura* pAura = m_caster->GetAura(spellShrink, EFFECT_INDEX_0)) if (Aura* pAura = m_caster->GetAura(spellShrink, EFFECT_INDEX_0))
{ {
uint8 stackNum = pAura->GetStackAmount(); uint32 stackNum = pAura->GetStackAmount();
// chance to become pygmified (5, 10, 15 etc) // chance to become pygmified (5, 10, 15 etc)
if (roll_chance_i(stackNum*5)) if (roll_chance_i(stackNum*5))

View file

@ -1891,7 +1891,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
triggered_spell_id = 31803; // Holy Vengeance triggered_spell_id = 31803; // Holy Vengeance
// Add 5-stack effect from Holy Vengeance // Add 5-stack effect from Holy Vengeance
int8 stacks = 0; uint32 stacks = 0;
AuraList const& auras = target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); AuraList const& auras = target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
{ {
@ -1901,7 +1901,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
break; break;
} }
} }
if(stacks >= 5) if (stacks >= 5)
CastSpell(target,42463,true,NULL,triggeredByAura); CastSpell(target,42463,true,NULL,triggeredByAura);
break; break;
} }
@ -1993,7 +1993,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
triggered_spell_id = 53742; // Blood Corruption triggered_spell_id = 53742; // Blood Corruption
// Add 5-stack effect from Blood Corruption // Add 5-stack effect from Blood Corruption
int8 stacks = 0; uint32 stacks = 0;
AuraList const& auras = target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); AuraList const& auras = target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) for(AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
{ {
@ -2003,7 +2003,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
break; break;
} }
} }
if(stacks >= 5) if (stacks >= 5)
CastSpell(target,53739,true,NULL,triggeredByAura); CastSpell(target,53739,true,NULL,triggeredByAura);
break; break;
} }
@ -3127,7 +3127,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d
Aura * dummy = GetDummyAura(37658); Aura * dummy = GetDummyAura(37658);
// release at 3 aura in stack (cont contain in basepoint of trigger aura) // release at 3 aura in stack (cont contain in basepoint of trigger aura)
if(!dummy || dummy->GetStackAmount() < triggerAmount) if(!dummy || dummy->GetStackAmount() < uint32(triggerAmount))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
RemoveAurasDueToSpell(37658); RemoveAurasDueToSpell(37658);
@ -3152,7 +3152,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d
// counting // counting
Aura * dummy = GetDummyAura(54842); Aura * dummy = GetDummyAura(54842);
// release at 3 aura in stack (cont contain in basepoint of trigger aura) // release at 3 aura in stack (cont contain in basepoint of trigger aura)
if(!dummy || dummy->GetStackAmount() < triggerAmount) if(!dummy || dummy->GetStackAmount() < uint32(triggerAmount))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;
RemoveAurasDueToSpell(54842); RemoveAurasDueToSpell(54842);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10483" #define REVISION_NR "10484"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__