[9415] Dome not catched cases for MAX_EFFECT_INDEX use.

This commit is contained in:
VladimirMangos 2010-02-19 19:56:09 +03:00
parent 231720c10f
commit 233e75ab4b
6 changed files with 43 additions and 41 deletions

View file

@ -890,7 +890,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!eqInfo) if (!eqInfo)
continue; continue;
for(uint8 j=0; j<3; j++) for(uint8 j = 0; j < 3; ++j)
{ {
if (!eqInfo->equipentry[j]) if (!eqInfo->equipentry[j])
continue; continue;
@ -4406,7 +4406,7 @@ void ObjectMgr::LoadSpellScripts()
//check for correct spellEffect //check for correct spellEffect
bool found = false; bool found = false;
for(int i=0; i<3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
// skip empty effects // skip empty effects
if (!spellInfo->Effect[i]) if (!spellInfo->Effect[i])
@ -4459,7 +4459,7 @@ void ObjectMgr::LoadEventScripts()
SpellEntry const * spell = sSpellStore.LookupEntry(i); SpellEntry const * spell = sSpellStore.LookupEntry(i);
if (spell) if (spell)
{ {
for(int j=0; j<3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT ) if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
{ {
@ -7957,7 +7957,7 @@ void ObjectMgr::LoadTrainerSpell()
// calculate learned spell for profession case when stored cast-spell // calculate learned spell for profession case when stored cast-spell
trainerSpell.learnedSpell = spell; trainerSpell.learnedSpell = spell;
for(int i = 0; i <3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL) if (spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
continue; continue;

View file

@ -7205,7 +7205,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if(!pEnchant) continue; if(!pEnchant) continue;
for (int s=0;s<3;s++) for (int s = 0; s < 3; ++s)
{ {
if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue; continue;
@ -7302,7 +7302,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if(!pEnchant) continue; if(!pEnchant) continue;
for (int s=0;s<3;s++) for (int s = 0; s < 3; ++s)
{ {
if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_USE_SPELL) if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_USE_SPELL)
continue; continue;

View file

@ -1677,7 +1677,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
if (!pEnchant) if (!pEnchant)
return; return;
for (int s=0;s<3;s++) for (int s = 0; s < 3; ++s)
{ {
if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue; continue;

View file

@ -1872,7 +1872,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
return spellInfo; return spellInfo;
bool needRankSelection = false; bool needRankSelection = false;
for(int i=0;i<3;++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
if (IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)) && ( if (IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)) && (
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
@ -2340,7 +2340,7 @@ void SpellMgr::LoadSpellScriptTarget()
continue; continue;
bool found = false; bool found = false;
for(int j=0; j<3; ++j) for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
{ {
if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT ) if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT )
{ {
@ -2617,7 +2617,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
bool need_check_reagents = false; bool need_check_reagents = false;
// check effects // check effects
for(int i=0; i<3; ++i) for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch(spellInfo->Effect[i]) switch(spellInfo->Effect[i])
{ {

View file

@ -6439,13 +6439,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 54939: case 54939:
{ {
// Lookup base amount mana restore // Lookup base amount mana restore
for (int i=0; i<3;++i) for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE) if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
{ {
int32 mana = procSpell->EffectBasePoints[i]; int32 mana = procSpell->EffectBasePoints[i];
CastCustomSpell(this, 54986, NULL, &mana, NULL, true, castItem, triggeredByAura); CastCustomSpell(this, 54986, NULL, &mana, NULL, true, castItem, triggeredByAura);
break; break;
} }
}
return true; return true;
} }
// Sacred Shield (buff) // Sacred Shield (buff)
@ -12849,7 +12851,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT
bool DirectDamage = false; bool DirectDamage = false;
bool AreaEffect = false; bool AreaEffect = false;
for ( uint32 i=0; i<3;++i) for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {
switch (spellProto->Effect[i]) switch (spellProto->Effect[i])
{ {

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 "9414" #define REVISION_NR "9415"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__