moved internal time step setting to Game

player should not be able change it as it is not synced yet
This commit is contained in:
Matthias Mailänder
2014-03-12 11:51:14 +01:00
parent ba79e33d40
commit c5ef9cbfb2
3 changed files with 7 additions and 10 deletions

View File

@@ -73,7 +73,7 @@ namespace OpenRA
public static int RenderFrame = 0; public static int RenderFrame = 0;
public static int NetFrameNumber { get { return orderManager.NetFrameNumber; } } public static int NetFrameNumber { get { return orderManager.NetFrameNumber; } }
public static int LocalTick { get { return orderManager.LocalFrameNumber; } } 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 const int Timestep = 40;
public static event Action<OrderManager> ConnectionStateChanged = _ => { }; public static event Action<OrderManager> ConnectionStateChanged = _ => { };
@@ -163,14 +163,15 @@ namespace OpenRA
static void TickInner(OrderManager orderManager) static void TickInner(OrderManager orderManager)
{ {
int t = Environment.TickCount; var t = Environment.TickCount;
int dt = t - orderManager.LastTickTime; var dt = t - orderManager.LastTickTime;
if (dt >= Settings.Game.Timestep) var world = orderManager.world;
var timestep = world == null ? Timestep : world.Timestep;
if (dt >= timestep)
using (new PerfSample("tick_time")) using (new PerfSample("tick_time"))
{ {
orderManager.LastTickTime += Settings.Game.Timestep; orderManager.LastTickTime += timestep;
Ui.Tick(); Ui.Tick();
var world = orderManager.world;
if (orderManager.GameStarted) if (orderManager.GameStarted)
++Viewport.TicksSinceLastMove; ++Viewport.TicksSinceLastMove;

View File

@@ -135,9 +135,6 @@ namespace OpenRA.GameRules
public bool AlwaysShowStatusBars = false; public bool AlwaysShowStatusBars = false;
public bool TeamHealthColors = false; public bool TeamHealthColors = false;
// Internal game settings
public int Timestep = 40;
public bool AllowDownloading = true; public bool AllowDownloading = true;
public string[] MapRepositories = { "http://resource.openra.net/map/", "http://resource.ihptru.net:8080/map/" }; public string[] MapRepositories = { "http://resource.openra.net/map/", "http://resource.ihptru.net:8080/map/" };
} }

View File

@@ -479,7 +479,6 @@
<Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" /> <Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" />
<Compile Include="Activities\FlyFollow.cs" /> <Compile Include="Activities\FlyFollow.cs" />
<Compile Include="Modifiers\DisabledOverlay.cs" /> <Compile Include="Modifiers\DisabledOverlay.cs" />
<Compile Include="Widgets\Logic\ReplayControlBarLogic.cs" />
<Compile Include="Widgets\Logic\GameTimerLogic.cs" /> <Compile Include="Widgets\Logic\GameTimerLogic.cs" />
<Compile Include="Immobile.cs" /> <Compile Include="Immobile.cs" />
</ItemGroup> </ItemGroup>