Keep army and income graph disabled if they were disabled once
This commit is contained in:
@@ -62,12 +62,17 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
int ticks;
|
int ticks;
|
||||||
int replayTimestep;
|
int replayTimestep;
|
||||||
|
|
||||||
|
bool armyGraphDisabled;
|
||||||
|
bool incomeGraphDisabled;
|
||||||
|
|
||||||
public PlayerStatistics(Actor self) { }
|
public PlayerStatistics(Actor self) { }
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
resources = self.TraitOrDefault<PlayerResources>();
|
resources = self.TraitOrDefault<PlayerResources>();
|
||||||
experience = self.TraitOrDefault<PlayerExperience>();
|
experience = self.TraitOrDefault<PlayerExperience>();
|
||||||
|
|
||||||
|
incomeGraphDisabled = resources == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
@@ -79,11 +84,15 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
|
|
||||||
if (ArmyValue != 0 || self.Owner.WinState == WinState.Undefined)
|
if (!armyGraphDisabled && (ArmyValue != 0 || self.Owner.WinState == WinState.Undefined))
|
||||||
ArmySamples.Add(ArmyValue);
|
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);
|
IncomeSamples.Add(Income);
|
||||||
|
else
|
||||||
|
incomeGraphDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resources == null)
|
if (resources == null)
|
||||||
@@ -134,7 +143,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (w.IsReplay)
|
if (w.IsReplay)
|
||||||
replayTimestep = w.WorldActor.Trait<MapOptions>().GameSpeed.Timestep;
|
replayTimestep = w.WorldActor.Trait<MapOptions>().GameSpeed.Timestep;
|
||||||
|
|
||||||
|
if (!armyGraphDisabled)
|
||||||
ArmySamples.Add(ArmyValue);
|
ArmySamples.Add(ArmyValue);
|
||||||
|
|
||||||
|
if (!incomeGraphDisabled)
|
||||||
IncomeSamples.Add(Income);
|
IncomeSamples.Add(Income);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user