diff --git a/OpenRA.Game/GameInformation.cs b/OpenRA.Game/GameInformation.cs index a053d92bd0..71f0e3f897 100644 --- a/OpenRA.Game/GameInformation.cs +++ b/OpenRA.Game/GameInformation.cs @@ -24,6 +24,7 @@ namespace OpenRA public string MapUid; public string MapTitle; + public int FinalGameTick; /// Game start timestamp (when the recoding started). public DateTime StartTimeUtc; diff --git a/OpenRA.Game/Network/ReplayConnection.cs b/OpenRA.Game/Network/ReplayConnection.cs index 82463abb24..07c41b0555 100644 --- a/OpenRA.Game/Network/ReplayConnection.cs +++ b/OpenRA.Game/Network/ReplayConnection.cs @@ -33,6 +33,7 @@ namespace OpenRA.Network public int LocalClientId { get { return 0; } } public ConnectionState ConnectionState { get { return ConnectionState.Connected; } } public readonly int TickCount; + public readonly int FinalGameTick; public readonly bool IsValid; public readonly Session LobbyInfo; public readonly string Filename; @@ -40,6 +41,7 @@ namespace OpenRA.Network public ReplayConnection(string replayFilename) { Filename = replayFilename; + FinalGameTick = ReplayMetadata.Read(replayFilename).GameInfo.FinalGameTick; // Parse replay data into a struct that can be fed to the game in chunks // to avoid issues with all immediate orders being resolved on the first tick. diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index 73b62b8b46..83fa5b13ee 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -66,7 +66,7 @@ namespace OpenRA foreach (var t in WorldActor.TraitsImplementing()) t.GameOver(this); - + gameInfo.FinalGameTick = WorldTick; GameOver(); } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs index 6dd51fb768..5e80e2999a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var connection = orderManager.Connection as ReplayConnection; if (connection != null && connection.TickCount != 0) - timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount); + timerTooltip.GetTooltipText = () => "{0}% complete".F(world.WorldTick * 100 / connection.FinalGameTick); else timerTooltip.GetTooltipText = null; }