Migrate DamageState thresholds to integer

While avoiding divisions.

While there haven't been any desyncs to speak of recently (not in this part of the code, in any case), this still looks like an oversight from when we migrated away from using floats.
This also makes it easier to expose the thresholds to modders later.
This commit is contained in:
reaperrr
2018-09-18 00:50:21 +02:00
committed by Paul Chote
parent 0b0c3b7170
commit 43693d84d1

View File

@@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Traits
if (hp <= 0)
return DamageState.Dead;
if (hp < MaxHP * 0.25f)
if (hp * 100L < MaxHP * 25L)
return DamageState.Critical;
if (hp < MaxHP * 0.5f)
if (hp * 100L < MaxHP * 50L)
return DamageState.Heavy;
if (hp < MaxHP * 0.75f)
if (hp * 100L < MaxHP * 75L)
return DamageState.Medium;
if (hp == MaxHP)