diff --git a/OpenRA.FileFormats/ProtocolVersion.cs b/OpenRA.FileFormats/ProtocolVersion.cs index fbc91caaac..3bba5d8915 100644 --- a/OpenRA.FileFormats/ProtocolVersion.cs +++ b/OpenRA.FileFormats/ProtocolVersion.cs @@ -23,6 +23,6 @@ namespace OpenRA.FileFormats public static class ProtocolVersion { // you *must* increment this whenever you make an incompatible protocol change - public static readonly int Version = 3; + public static readonly int Version = 4; } } diff --git a/OpenRA.Game/Chrome.cs b/OpenRA.Game/Chrome.cs index 0d7d20e5f7..b60827e972 100644 --- a/OpenRA.Game/Chrome.cs +++ b/OpenRA.Game/Chrome.cs @@ -411,8 +411,7 @@ namespace OpenRA void CycleReady(bool left) { - Game.IssueOrder( - new Order("ToggleReady", Game.world.LocalPlayer.PlayerActor, "") { IsImmediate = true }); + Game.IssueOrder(Order.Chat("/ready")); } void CycleSpawnPoint(bool left) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 9cccd3e8c9..0ff00ce6dc 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -258,6 +258,39 @@ namespace OpenRA.Server { var dict = new Dictionary> { + { "ready", + s => + { + // if we're downloading, we can't ready up. + + var client = GetClient(conn); + if (client.State == Session.ClientState.NotReady) + client.State = Session.ClientState.Ready; + else if (client.State == Session.ClientState.Ready) + client.State = Session.ClientState.NotReady; + + Console.WriteLine("Player @{0} is {1}", + conn.socket.RemoteEndPoint, client.State); + + SyncLobbyInfo(); + + // start the game if everyone is ready. + if (conns.Count > 0 && conns.All(c => GetClient(c).State == Session.ClientState.Ready)) + { + Console.WriteLine("All players are ready. Starting the game!"); + GameStarted = true; + foreach( var c in conns ) + foreach( var d in conns ) + DispatchOrdersToClient( c, d.PlayerIndex, 0x7FFFFFFF, new byte[] { 0xBF } ); + + DispatchOrders(null, 0, + new ServerOrder("StartGame", "").Serialize()); + + PingMasterServer(); + } + + return true; + }}, { "name", s => { @@ -431,38 +464,6 @@ namespace OpenRA.Server { switch (so.Name) { - case "ToggleReady": - { - // if we're downloading, we can't ready up. - - var client = GetClient(conn); - if (client.State == Session.ClientState.NotReady) - client.State = Session.ClientState.Ready; - else if (client.State == Session.ClientState.Ready) - client.State = Session.ClientState.NotReady; - - Console.WriteLine("Player @{0} is {1}", - conn.socket.RemoteEndPoint, client.State); - - SyncLobbyInfo(); - - // start the game if everyone is ready. - if (conns.Count > 0 && conns.All(c => GetClient(c).State == Session.ClientState.Ready)) - { - Console.WriteLine("All players are ready. Starting the game!"); - GameStarted = true; - foreach( var c in conns ) - foreach( var d in conns ) - DispatchOrdersToClient( c, d.PlayerIndex, 0x7FFFFFFF, new byte[] { 0xBF } ); - - DispatchOrders(null, 0, - new ServerOrder("StartGame", "").Serialize()); - - PingMasterServer(); - } - } - break; - case "Chat": if (so.Data.StartsWith("/")) {