Reimplement pinging via the orders channel.

This commit is contained in:
Paul Chote
2013-04-22 20:36:36 +12:00
parent 9f4b323287
commit 9069d98365
10 changed files with 89 additions and 19 deletions

View File

@@ -199,7 +199,12 @@ namespace OpenRA
{
return new Order("HandshakeResponse", null, false) { IsImmediate = true, TargetString = text };
}
public static Order Pong(string pingTime)
{
return new Order("Pong", null, false) { IsImmediate = true, TargetString = pingTime };
}
public static Order PauseGame(bool paused)
{
return new Order("PauseGame", null, false) { TargetString = paused ? "Pause" : "UnPause" };

View File

@@ -62,6 +62,8 @@ namespace OpenRA.Network
public bool IsReady { get { return State == ClientState.Ready; } }
public bool IsObserver { get { return Slot == null; } }
public int Ping = -1;
public int PingJitter = -1;
public int[] PingHistory = {};
}
public class Slot

View File

@@ -190,6 +190,11 @@ namespace OpenRA.Network
Game.Debug("{0} has reciprocated",targetPlayer.PlayerName);
}
break;
}
case "Ping":
{
orderManager.IssueOrder(Order.Pong(order.TargetString));
break;
}
default: