Skip to content

Commit

Permalink
More robust logic for ThisMinute stats
Browse files Browse the repository at this point in the history
  • Loading branch information
teinarss authored and reaperrr committed Sep 6, 2019
1 parent 79627d0 commit 55ba6b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
#endregion

using System;
using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Traits;
Expand Down Expand Up @@ -60,6 +61,7 @@ public int Experience

public int ArmyValue;
int replayTimestep;
int ticks;

public PlayerStatistics(Actor self) { }

Expand All @@ -86,10 +88,12 @@ void UpdateArmyThisMinute()

void ITick.Tick(Actor self)
{
ticks++;
var timestep = self.World.IsReplay ? replayTimestep : self.World.Timestep;

if (timestep * self.World.WorldTick % 60000 == 0)
if (ticks * timestep >= 60000)
{
ticks = 0;
UpdateEarnedThisMinute();
UpdateArmyThisMinute();
}
Expand Down

0 comments on commit 55ba6b9

Please sign in to comment.