From 6fe31e44cb77d98f7ba954584d4c55d8bad372be Mon Sep 17 00:00:00 2001 From: teinarss Date: Wed, 28 Aug 2019 20:20:45 +0200 Subject: [PATCH] More robust logic for ThisMinute stats --- OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs index 169f813da3..0b6e7f46cf 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerStatistics.cs @@ -9,6 +9,7 @@ */ #endregion +using System; using System.Collections.Generic; using OpenRA.Graphics; using OpenRA.Traits; @@ -60,6 +61,7 @@ namespace OpenRA.Mods.Common.Traits public int ArmyValue; int replayTimestep; + int ticks; public PlayerStatistics(Actor self) { } @@ -86,10 +88,12 @@ namespace OpenRA.Mods.Common.Traits 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(); }