[9862] Defines for some spelentry arrays.

* Move and rename MAX_REAGENTS to DBC Strcuture.h.
  It used only afore access to SpellEntry field and so part of strcuture definition.
* Add MAX_SPELL_TOTEMS and MAX_SPELL_TOTEM_CATEGORIES for same reasons, and use in code.
This commit is contained in:
VladimirMangos 2010-05-11 00:02:32 +04:00
parent ff2cda6af1
commit 6fb07911f9
6 changed files with 23 additions and 22 deletions

View file

@ -3261,16 +3261,14 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
}
break;
case SPELL_FAILED_TOTEMS:
if(spellInfo->Totem[0])
data << uint32(spellInfo->Totem[0]);
if(spellInfo->Totem[1])
data << uint32(spellInfo->Totem[1]);
for(int i = 0; i < MAX_SPELL_TOTEMS; ++i)
if(spellInfo->Totem[i])
data << uint32(spellInfo->Totem[i]);
break;
case SPELL_FAILED_TOTEM_CATEGORY:
if(spellInfo->TotemCategory[0])
data << uint32(spellInfo->TotemCategory[0]);
if(spellInfo->TotemCategory[1])
data << uint32(spellInfo->TotemCategory[1]);
for(int i = 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i)
if(spellInfo->TotemCategory[i])
data << uint32(spellInfo->TotemCategory[i]);
break;
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
data << uint32(spellInfo->EquippedItemClass);
@ -3958,7 +3956,7 @@ void Spell::TakeReagents()
if (p_caster->CanNoReagentCast(m_spellInfo) )
return;
for(uint32 x = 0; x < MAX_REAGENTS; ++x)
for(uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
{
if(m_spellInfo->Reagent[x] <= 0)
continue;
@ -5643,7 +5641,7 @@ SpellCastResult Spell::CheckItems()
{
if (!p_caster->CanNoReagentCast(m_spellInfo))
{
for(uint32 i = 0; i < MAX_REAGENTS; ++i)
for(uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i)
{
if(m_spellInfo->Reagent[i] <= 0)
continue;
@ -5675,8 +5673,8 @@ SpellCastResult Spell::CheckItems()
}
// check totem-item requirements (items presence in inventory)
uint32 totems = 2;
for(int i = 0; i < 2 ; ++i)
uint32 totems = MAX_SPELL_TOTEMS;
for(int i = 0; i < MAX_SPELL_TOTEMS ; ++i)
{
if (m_spellInfo->Totem[i] != 0)
{
@ -5694,8 +5692,8 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_TOTEMS;
// Check items for TotemCategory (items presence in inventory)
uint32 TotemCategory = 2;
for(int i= 0; i < 2; ++i)
uint32 TotemCategory = MAX_SPELL_TOTEM_CATEGORIES;
for(int i= 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i)
{
if (m_spellInfo->TotemCategory[i] != 0)
{