From ba9611f544bda90df7da831881d1f38c048011de Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 22 Sep 2010 21:43:04 +1200 Subject: [PATCH] un-FP Building.cs power stuff --- OpenRA.Game/Traits/Building.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/Traits/Building.cs b/OpenRA.Game/Traits/Building.cs index 570462204f..64f506f3af 100644 --- a/OpenRA.Game/Traits/Building.cs +++ b/OpenRA.Game/Traits/Building.cs @@ -64,19 +64,14 @@ namespace OpenRA.Traits return Info.Power; var health = self.TraitOrDefault(); - var healthFraction = (health == null) ? 1f : health.HPFraction; - return (int)(healthFraction * Info.Power); + return health != null ? (Info.Power * health.HP / health.MaxHP) : Info.Power; } public void Damaged(Actor self, AttackInfo e) { // Power plants lose power with damage if (Info.Power > 0) - { - var health = self.TraitOrDefault(); - var healthFraction = (health == null) ? 1f : health.HPFraction; - PlayerPower.UpdateActor(self, (int)(healthFraction * Info.Power)); - } + PlayerPower.UpdateActor(self, GetPowerUsage()); if (e.DamageState == DamageState.Dead) {