From c5ef9cbfb269244b2c94d898a52f8138858d7963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 12 Mar 2014 11:51:14 +0100 Subject: [PATCH] moved internal time step setting to Game player should not be able change it as it is not synced yet --- OpenRA.Game/Game.cs | 13 +++++++------ OpenRA.Game/GameRules/Settings.cs | 3 --- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index f0b61be1e6..25ee37e312 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -73,7 +73,7 @@ namespace OpenRA public static int RenderFrame = 0; public static int NetFrameNumber { get { return orderManager.NetFrameNumber; } } public static int LocalTick { get { return orderManager.LocalFrameNumber; } } - public const int NetTickScale = 3; // 120ms net tick for 40ms local tick + public const int NetTickScale = 3; // 120 ms net tick for 40 ms local tick public const int Timestep = 40; public static event Action ConnectionStateChanged = _ => { }; @@ -163,14 +163,15 @@ namespace OpenRA static void TickInner(OrderManager orderManager) { - int t = Environment.TickCount; - int dt = t - orderManager.LastTickTime; - if (dt >= Settings.Game.Timestep) + var t = Environment.TickCount; + var dt = t - orderManager.LastTickTime; + var world = orderManager.world; + var timestep = world == null ? Timestep : world.Timestep; + if (dt >= timestep) using (new PerfSample("tick_time")) { - orderManager.LastTickTime += Settings.Game.Timestep; + orderManager.LastTickTime += timestep; Ui.Tick(); - var world = orderManager.world; if (orderManager.GameStarted) ++Viewport.TicksSinceLastMove; diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index 15bf950ebf..4295333806 100644 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -135,9 +135,6 @@ namespace OpenRA.GameRules public bool AlwaysShowStatusBars = false; public bool TeamHealthColors = false; - // Internal game settings - public int Timestep = 40; - public bool AllowDownloading = true; public string[] MapRepositories = { "http://resource.openra.net/map/", "http://resource.ihptru.net:8080/map/" }; } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 8a83a0958c..fd3c72d7ea 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -479,7 +479,6 @@ -