Improve game loop
Environment.TickCount was replaced with Game.RunTime that's based on Stopwatch for increased accuracy.
This commit is contained in:
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
|
||||
public void Tick(S server)
|
||||
{
|
||||
if ((Environment.TickCount - lastPing > MasterPingInterval * 1000) || isInitialPing)
|
||||
if ((Game.RunTime - lastPing > MasterPingInterval * 1000) || isInitialPing)
|
||||
PingMasterServer(server);
|
||||
else
|
||||
lock (masterServerMessages)
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Server
|
||||
{
|
||||
if (isBusy || !server.Settings.AdvertiseOnline) return;
|
||||
|
||||
lastPing = Environment.TickCount;
|
||||
lastPing = Game.RunTime;
|
||||
isBusy = true;
|
||||
|
||||
var mod = server.ModData.Manifest.Mod;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user