From ad75e2be8947a9620f82b2c9026a044a922d33c2 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 14 Aug 2020 17:10:34 +0100 Subject: [PATCH] Remove redundant check from SupportPowerInstance. --- .../SupportPowers/SupportPowerManager.cs | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 8fb1312067..217a32eca7 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -203,27 +203,23 @@ namespace OpenRA.Mods.Common.Traits if (!Active) return; - if (Active) + var power = Instances.First(); + if (Manager.DevMode.FastCharge && remainingSubTicks > 2500) + remainingSubTicks = 2500; + + if (remainingSubTicks > 0) + remainingSubTicks = (remainingSubTicks - 100).Clamp(0, TotalTicks * 100); + + if (!notifiedCharging) { - var power = Instances.First(); - if (Manager.DevMode.FastCharge && remainingSubTicks > 2500) - remainingSubTicks = 2500; + power.Charging(power.Self, Key); + notifiedCharging = true; + } - if (remainingSubTicks > 0) - remainingSubTicks = (remainingSubTicks - 100).Clamp(0, TotalTicks * 100); - - if (!notifiedCharging) - { - power.Charging(power.Self, Key); - notifiedCharging = true; - } - - if (RemainingTicks == 0 - && !notifiedReady) - { - power.Charged(power.Self, Key); - notifiedReady = true; - } + if (RemainingTicks == 0 && !notifiedReady) + { + power.Charged(power.Self, Key); + notifiedReady = true; } }