From 3672b4e674089378bdd44e4df4464ed4937de5ce Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 6 Oct 2019 17:24:56 +0200 Subject: [PATCH] Keep army and income graph disabled if they were disabled once --- .../Traits/Player/PlayerStatistics.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index 29553572e8..f2957290e2 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -62,12 +62,17 @@ namespace OpenRA.Mods.Common.Traits int ticks; int replayTimestep; + bool armyGraphDisabled; + bool incomeGraphDisabled; + public PlayerStatistics(Actor self) { } void INotifyCreated.Created(Actor self) { resources = self.TraitOrDefault(); experience = self.TraitOrDefault(); + + incomeGraphDisabled = resources == null; } void ITick.Tick(Actor self) @@ -79,11 +84,15 @@ namespace OpenRA.Mods.Common.Traits { ticks = 0; - if (ArmyValue != 0 || self.Owner.WinState == WinState.Undefined) + if (!armyGraphDisabled && (ArmyValue != 0 || self.Owner.WinState == WinState.Undefined)) ArmySamples.Add(ArmyValue); + else + armyGraphDisabled = true; - if (resources != null && (Income != 0 || self.Owner.WinState == WinState.Undefined)) + if (!incomeGraphDisabled && (Income != 0 || self.Owner.WinState == WinState.Undefined)) IncomeSamples.Add(Income); + else + incomeGraphDisabled = true; } if (resources == null) @@ -134,8 +143,11 @@ namespace OpenRA.Mods.Common.Traits if (w.IsReplay) replayTimestep = w.WorldActor.Trait().GameSpeed.Timestep; - ArmySamples.Add(ArmyValue); - IncomeSamples.Add(Income); + if (!armyGraphDisabled) + ArmySamples.Add(ArmyValue); + + if (!incomeGraphDisabled) + IncomeSamples.Add(Income); } }