Fix UnitMods. This fixes buffer overflows.

/me pokes @Fabi
This commit is contained in:
LordJZ 2012-08-12 08:43:46 +04:00 committed by Antz
parent adabb1556d
commit a5ca883668
2 changed files with 11 additions and 0 deletions

View file

@ -223,6 +223,8 @@ void Player::UpdateMaxHealth()
void Player::UpdateMaxPower(Powers power)
{
MANGOS_ASSERT(power < MAX_POWERS);
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
uint32 create_power = GetCreatePowers(power);
@ -856,6 +858,8 @@ void Creature::UpdateMaxHealth()
void Creature::UpdateMaxPower(Powers power)
{
MANGOS_ASSERT(power < MAX_POWERS);
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
float value = GetTotalAuraModValue(unitMod);
@ -1027,6 +1031,8 @@ void Pet::UpdateMaxHealth()
void Pet::UpdateMaxPower(Powers power)
{
MANGOS_ASSERT(power < MAX_POWERS);
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;