*Fix some out-of-range array indices of totem slot and charm spell slot.
--HG-- branch : trunk
This commit is contained in:
+5
-5
@@ -17207,7 +17207,7 @@ void Player::PetSpellInitialize()
|
||||
data << uint8(pet->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
|
||||
|
||||
// action bar loop
|
||||
for(uint32 i = 0; i < 10; i++)
|
||||
for(uint32 i = 0; i < MAX_SPELL_CONTROL_BAR; ++i)
|
||||
{
|
||||
data << uint32(charmInfo->GetActionBarEntry(i)->Raw);
|
||||
}
|
||||
@@ -17336,7 +17336,7 @@ void Player::VehicleSpellInitialize()
|
||||
data << uint16(spellId) << uint8(0) << uint8(i+8);
|
||||
}
|
||||
|
||||
for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i)
|
||||
for(uint32 i = CREATURE_MAX_SPELLS; i < MAX_SPELL_CONTROL_BAR; ++i)
|
||||
data << uint16(0) << uint8(0) << uint8(i+8);
|
||||
|
||||
data << uint8(0);
|
||||
@@ -17365,7 +17365,7 @@ void Player::CharmSpellInitialize()
|
||||
CreatureInfo const *cinfo = ((Creature*)charm)->GetCreatureInfo();
|
||||
//if(cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
for(uint32 i = 0; i < 4; ++i)
|
||||
for(uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
|
||||
{
|
||||
if(charmInfo->GetCharmSpell(i)->spellId)
|
||||
++addlist;
|
||||
@@ -17386,7 +17386,7 @@ void Player::CharmSpellInitialize()
|
||||
data << uint16(0);
|
||||
|
||||
//action bar 40
|
||||
for(uint32 i = 0; i < 10; ++i) //40
|
||||
for(uint32 i = 0; i < MAX_SPELL_CONTROL_BAR; ++i) //40
|
||||
{
|
||||
data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type);
|
||||
}
|
||||
@@ -17395,7 +17395,7 @@ void Player::CharmSpellInitialize()
|
||||
data << uint8(addlist); //1
|
||||
if(addlist)
|
||||
{
|
||||
for(uint32 i = 0; i < 4; ++i)
|
||||
for(uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
|
||||
{
|
||||
CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i);
|
||||
if(cspell->spellId)
|
||||
|
||||
@@ -6539,7 +6539,7 @@ void Spell::SummonTotem(uint32 entry, SummonPropertiesEntry const *properties)
|
||||
|
||||
pTotem->Relocate(x, y, z, m_caster->GetOrientation());
|
||||
|
||||
if(slot < MAX_TOTEM)
|
||||
if(slot >= 0 && slot < MAX_TOTEM)
|
||||
m_caster->m_TotemSlot[slot] = pTotem->GetGUID();
|
||||
|
||||
pTotem->SetOwner(m_caster->GetGUID());
|
||||
|
||||
+3
-3
@@ -8157,7 +8157,7 @@ bool Unit::isAttackingPlayer() const
|
||||
if(charmed && charmed->isAttackingPlayer())
|
||||
return true;
|
||||
|
||||
for (int8 i = 0; i < MAX_TOTEM; i++)
|
||||
for (int8 i = 0; i < MAX_SUMMON_SLOT; ++i)
|
||||
{
|
||||
if(m_TotemSlot[i])
|
||||
{
|
||||
@@ -11561,7 +11561,7 @@ void CharmInfo::InitCharmCreateSpells()
|
||||
|
||||
InitPetActionBar();
|
||||
|
||||
for(uint32 x = 0; x < 4; ++x)
|
||||
for(uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
|
||||
{
|
||||
uint32 spellId = ((Creature*)m_unit)->m_spells[x];
|
||||
m_charmspells[x].spellId = spellId;
|
||||
@@ -11623,7 +11623,7 @@ void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply)
|
||||
if(IsPassiveSpell(spellid))
|
||||
return;
|
||||
|
||||
for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
|
||||
for(uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
|
||||
{
|
||||
if(spellid == m_charmspells[x].spellId)
|
||||
{
|
||||
|
||||
+5
-1
@@ -219,6 +219,10 @@ enum UnitRename
|
||||
};
|
||||
|
||||
#define CREATURE_MAX_SPELLS 8
|
||||
#define MAX_SPELL_CHARM 4
|
||||
#define MAX_SPELL_VEHICLE 6
|
||||
#define MAX_SPELL_POSSESS 8
|
||||
#define MAX_SPELL_CONTROL_BAR 10
|
||||
|
||||
enum Swing
|
||||
{
|
||||
@@ -1301,7 +1305,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
Spell* m_currentSpells[CURRENT_MAX_SPELL];
|
||||
|
||||
uint32 m_addDmgOnce;
|
||||
uint64 m_TotemSlot[MAX_TOTEM];
|
||||
uint64 m_TotemSlot[MAX_SUMMON_SLOT];
|
||||
uint64 m_ObjectSlot[4];
|
||||
uint32 m_detectInvisibilityMask;
|
||||
uint32 m_invisibilityMask;
|
||||
|
||||
Reference in New Issue
Block a user