From 43693d84d1d9b7d4221c86768dcde6e3b2246de4 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 18 Sep 2018 00:50:21 +0200 Subject: [PATCH] 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. --- OpenRA.Mods.Common/Traits/Health.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Health.cs b/OpenRA.Mods.Common/Traits/Health.cs index 935a2c1e5e..de66899d08 100644 --- a/OpenRA.Mods.Common/Traits/Health.cs +++ b/OpenRA.Mods.Common/Traits/Health.cs @@ -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)