Improve game loop

Environment.TickCount was replaced with Game.RunTime that's based on
Stopwatch for increased accuracy.
This commit is contained in:
Pavlos Touboulidis
2014-07-06 22:04:31 +03:00
parent fd68c81b15
commit b88b87b899
8 changed files with 246 additions and 159 deletions

View File

@@ -25,12 +25,12 @@ namespace OpenRA.Mods.RA.Server
bool isInitialPing = true;
public void Tick(S server)
{
if ((Environment.TickCount - lastPing > PingInterval) || isInitialPing)
if ((Game.RunTime - lastPing > PingInterval) || isInitialPing)
{
isInitialPing = false;
lastPing = Environment.TickCount;
lastPing = Game.RunTime;
foreach (var p in server.Conns)
server.SendOrderTo(p, "Ping", Environment.TickCount.ToString());
server.SendOrderTo(p, "Ping", Game.RunTime.ToString());
}
}
}