[8715] Fixed possible crashes and some typos

This commit is contained in:
AlexDereka 2009-10-23 17:07:13 +04:00
parent b1888bb343
commit f286a2e64e
5 changed files with 17 additions and 17 deletions

View file

@ -457,7 +457,7 @@ void BattleGroundAB::Reset()
//call parent's class reset //call parent's class reset
BattleGround::Reset(); BattleGround::Reset();
for (uint8 i = 0; i <= BG_TEAMS_COUNT; ++i) for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
{ {
m_TeamScores[i] = 0; m_TeamScores[i] = 0;
m_lastTick[i] = 0; m_lastTick[i] = 0;

View file

@ -1817,19 +1817,21 @@ void Spell::EffectDummy(uint32 i)
// Cleansing Totem // Cleansing Totem
if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673)
{ {
m_caster->CastSpell(unitTarget, 52025, true); if (unitTarget)
m_caster->CastSpell(unitTarget, 52025, true);
return; return;
} }
// Healing Stream Totem // Healing Stream Totem
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000))
{ {
m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); if (unitTarget)
m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
return; return;
} }
// Mana Spring Totem // Mana Spring Totem
if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{ {
if (unitTarget->getPowerType()!=POWER_MANA) if (!unitTarget || unitTarget->getPowerType()!=POWER_MANA)
return; return;
m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
return; return;

View file

@ -100,21 +100,19 @@ uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo)
if(DotDuration > 30000) if(DotDuration > 30000)
DotDuration = 30000; DotDuration = 30000;
int j = 0; for (int j = 0; j < 3; ++j)
for( ; j < 3; j++)
{ {
if( spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL || spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL ||
spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) )
{ {
if (spellInfo->EffectAmplitude[j] != 0)
return DotDuration / spellInfo->EffectAmplitude[j];
break; break;
} }
} }
if(spellInfo->EffectAmplitude[j] != 0)
return DotDuration / spellInfo->EffectAmplitude[j];
return 6; return 6;
} }

View file

@ -1568,17 +1568,17 @@ void Unit::HandleEmoteCommand(uint32 anim_id)
uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo /*= NULL*/) uint32 Unit::CalcNotIgnoreAbsorbDamage( uint32 damage, SpellSchoolMask damageSchoolMask, SpellEntry const* spellInfo /*= NULL*/)
{ {
float absorb_affected_rate = 1.0f; float absorb_affected_rate = 1.0f;
Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL); Unit::AuraList const& ignoreAbsorbSchool = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL);
for(Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i) for(Unit::AuraList::const_iterator i = ignoreAbsorbSchool.begin(); i != ignoreAbsorbSchool.end(); ++i)
if ((*i)->GetMiscValue() & damageSchoolMask) if ((*i)->GetMiscValue() & damageSchoolMask)
absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount)/100.0f; absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount)/100.0f;
if(spellInfo) if(spellInfo)
{ {
Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL); Unit::AuraList const& ignoreAbsorbForSpell = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL);
for(Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i) for(Unit::AuraList::const_iterator citr = ignoreAbsorbForSpell.begin(); citr != ignoreAbsorbForSpell.end(); ++citr)
if ((*i)->isAffectedOnSpell(spellInfo)) if ((*citr)->isAffectedOnSpell(spellInfo))
absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount)/100.0f; absorb_affected_rate *= (100.0f - (*citr)->GetModifier()->m_amount)/100.0f;
} }
return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage); return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage);

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 "8714" #define REVISION_NR "8715"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__