Skip to content

Commit

Permalink
PlayerStatistics should stop ticking after lost/win
Browse files Browse the repository at this point in the history
  • Loading branch information
teinarss authored and RoosterDragon committed Sep 13, 2019
1 parent 6946807 commit c15f66a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs
Expand Up @@ -45,10 +45,10 @@ public int Experience
}
}

public Queue<int> EarnedSamples = new Queue<int>(100);
public List<int> EarnedSamples = new List<int>(100);
int earnedAtBeginningOfMinute;

public Queue<int> ArmySamples = new Queue<int>(100);
public List<int> ArmySamples = new List<int>(100);

public int KillsCost;
public int DeathsCost;
Expand All @@ -73,22 +73,22 @@ void INotifyCreated.Created(Actor self)

void UpdateEarnedThisMinute()
{
EarnedSamples.Enqueue(EarnedThisMinute);
EarnedSamples.Add(EarnedThisMinute);
earnedAtBeginningOfMinute = resources != null ? resources.Earned : 0;
if (EarnedSamples.Count > 100)
EarnedSamples.Dequeue();
}

void UpdateArmyThisMinute()
{
ArmySamples.Enqueue(ArmyValue);
if (ArmySamples.Count > 100)
ArmySamples.Dequeue();
ArmySamples.Add(ArmyValue);
}

void ITick.Tick(Actor self)
{
if (self.Owner.WinState != WinState.Undefined)
return;

ticks++;

var timestep = self.World.IsReplay ? replayTimestep : self.World.Timestep;

if (ticks * timestep >= 60000)
Expand Down

0 comments on commit c15f66a

Please sign in to comment.