Core/Unit: fix logic error in DamageInfo::ModifyDamage.

Previous code did not protect against m_damage underflow, rather only allow up to duplicate damage.
It now should work as intended.

Closes #18154
(cherry picked from commit 7ced76bab2)

Core/Unit: fix warning reported by VS2015

C4146: unary minus operator applied to unsigned type, result still unsigned
(cherry picked from commit 7b1a0c3698)

Core/Unit: consistency fix
(cherry picked from commit 042023877a)
This commit is contained in:
ariel-
2016-10-27 18:29:56 +02:00
committed by joschiwald
parent b63cd1951f
commit e4bb4842b5

View File

@@ -173,7 +173,7 @@ DamageInfo::DamageInfo(SpellNonMeleeDamage const& spellNonMeleeDamage, DamageEff
void DamageInfo::ModifyDamage(int32 amount)
{
amount = std::min(amount, int32(GetDamage()));
amount = std::max(amount, -static_cast<int32>(GetDamage()));
m_damage += amount;
}