Move up Undamaged check in DamageState

A mere int comparison is obviously cheaper than
a comparison between two multiplications,
so pulling this above the checks of other damage states
allows us to bail early for undamaged actors.
This commit is contained in:
reaperrr
2021-02-20 20:28:20 +01:00
committed by teinarss
parent c240c0a24b
commit e2a6b55d44

View File

@@ -88,6 +88,9 @@ namespace OpenRA.Mods.Common.Traits
{
get
{
if (hp == MaxHP)
return DamageState.Undamaged;
if (hp <= 0)
return DamageState.Dead;
@@ -100,9 +103,6 @@ namespace OpenRA.Mods.Common.Traits
if (hp * 100L < MaxHP * 75L)
return DamageState.Medium;
if (hp == MaxHP)
return DamageState.Undamaged;
return DamageState.Light;
}
}