mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Fix UnitMods. This fixes buffer overflows.
/me pokes @Fabi
This commit is contained in:
parent
adabb1556d
commit
a5ca883668
2 changed files with 11 additions and 0 deletions
|
|
@ -223,6 +223,8 @@ void Player::UpdateMaxHealth()
|
||||||
|
|
||||||
void Player::UpdateMaxPower(Powers power)
|
void Player::UpdateMaxPower(Powers power)
|
||||||
{
|
{
|
||||||
|
MANGOS_ASSERT(power < MAX_POWERS);
|
||||||
|
|
||||||
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
||||||
|
|
||||||
uint32 create_power = GetCreatePowers(power);
|
uint32 create_power = GetCreatePowers(power);
|
||||||
|
|
@ -856,6 +858,8 @@ void Creature::UpdateMaxHealth()
|
||||||
|
|
||||||
void Creature::UpdateMaxPower(Powers power)
|
void Creature::UpdateMaxPower(Powers power)
|
||||||
{
|
{
|
||||||
|
MANGOS_ASSERT(power < MAX_POWERS);
|
||||||
|
|
||||||
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
||||||
|
|
||||||
float value = GetTotalAuraModValue(unitMod);
|
float value = GetTotalAuraModValue(unitMod);
|
||||||
|
|
@ -1027,6 +1031,8 @@ void Pet::UpdateMaxHealth()
|
||||||
|
|
||||||
void Pet::UpdateMaxPower(Powers power)
|
void Pet::UpdateMaxPower(Powers power)
|
||||||
{
|
{
|
||||||
|
MANGOS_ASSERT(power < MAX_POWERS);
|
||||||
|
|
||||||
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
||||||
|
|
||||||
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
|
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,13 @@ enum UnitMods
|
||||||
UNIT_MOD_RAGE,
|
UNIT_MOD_RAGE,
|
||||||
UNIT_MOD_FOCUS,
|
UNIT_MOD_FOCUS,
|
||||||
UNIT_MOD_ENERGY,
|
UNIT_MOD_ENERGY,
|
||||||
|
UNIT_MOD_HAPPINESS, // REQUIRED for fast indexing to work.
|
||||||
UNIT_MOD_RUNE,
|
UNIT_MOD_RUNE,
|
||||||
UNIT_MOD_RUNIC_POWER,
|
UNIT_MOD_RUNIC_POWER,
|
||||||
|
UNIT_MOD_SOUL_SHARDS,
|
||||||
|
UNIT_MOD_ECLIPSE,
|
||||||
|
UNIT_MOD_HOLY_POWER,
|
||||||
|
UNIT_MOD_ALTERNATE,
|
||||||
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum.
|
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum.
|
||||||
UNIT_MOD_RESISTANCE_HOLY,
|
UNIT_MOD_RESISTANCE_HOLY,
|
||||||
UNIT_MOD_RESISTANCE_FIRE,
|
UNIT_MOD_RESISTANCE_FIRE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue