From 6e4cf37e449d407917f900b466a1f9b2e759f095 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 26 Jun 2013 21:42:56 +1200 Subject: [PATCH 1/3] Fixes #3336. --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index 8d1d79b352..80169c5309 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -55,12 +55,17 @@ namespace OpenRA.Mods.RA.Server void CheckAutoStart(S server, Connection conn, Session.Client client) { - var actualPlayers = server.conns - .Select(c => server.GetClient(c)) - .Where(c => c.Slot != null); + var playerClients = server.lobbyInfo.Clients.Where(c => c.Bot == null && c.Slot != null); - if (actualPlayers.Count() > 0 && actualPlayers.All(c => c.State == Session.ClientState.Ready)) - InterpretCommand(server, conn, client, "startgame"); + // Are all players ready? + if (playerClients.Count() == 0 || playerClients.Any(c => c.State != Session.ClientState.Ready)) + return; + + // Are the map conditions satisfied? + if (server.lobbyInfo.Slots.Any(sl => sl.Value.Required && server.lobbyInfo.ClientInSlot(sl.Key) == null)) + return; + + server.StartGame(); } public bool InterpretCommand(S server, Connection conn, Session.Client client, string cmd) From 859af00f1c03a479918f052c36305d4bbe6652fb Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 26 Jun 2013 22:21:13 +1200 Subject: [PATCH 2/3] Remove unused spectator ready checkboxes. --- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 2 -- mods/cnc/chrome/lobby.yaml | 21 +++------------- mods/d2k/chrome/lobby.yaml | 29 +++------------------- mods/ra/chrome/lobby.yaml | 29 +++------------------- 4 files changed, 12 insertions(+), 69 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index c73be9437c..3a7a9febba 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -460,7 +460,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager); LobbyUtils.SetupEditableColorWidget(template, null, c, orderManager, colorPreview); - LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager); } // Non-editable spectator else @@ -471,7 +470,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupNameWidget(template, null, client); LobbyUtils.SetupKickWidget(template, null, client, orderManager); LobbyUtils.SetupColorWidget(template, null, client); - LobbyUtils.SetupReadyWidget(template, null, client); } LobbyUtils.SetupClientWidget(template, null, c, orderManager, true); diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index c15a57c511..0410b00c54 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -309,17 +309,12 @@ Container@SERVER_LOBBY: Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:220-55 + Width:250 Height:25 - X:280 + X:255 Y:0 Align:Center Font:Bold - Checkbox@STATUS_CHECKBOX: - X:448 - Y:2 - Width:20 - Height:20 Container@TEMPLATE_NONEDITABLE_SPECTATOR: X:5 Y:0 @@ -370,20 +365,12 @@ Container@SERVER_LOBBY: Height:13 Label@SPECTATOR: Text:Spectator - Width:220-55 + Width:250 Height:25 - X:280 + X:255 Y:0 Align:Center Font:Bold - Image@STATUS_IMAGE: - Visible:false - X:450 - Y:4 - Width:20 - Height:20 - ImageCollection:checkbox-bits - ImageName:checked Container@TEMPLATE_NEW_SPECTATOR: X:5 Y:0 diff --git a/mods/d2k/chrome/lobby.yaml b/mods/d2k/chrome/lobby.yaml index 6e84285366..e9318f10ab 100644 --- a/mods/d2k/chrome/lobby.yaml +++ b/mods/d2k/chrome/lobby.yaml @@ -286,25 +286,12 @@ Background@SERVER_LOBBY: Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:198 + Width:225 Height:25 - X:240 + X:245 Y:0 Align:Center Font:Bold - Checkbox@STATUS_CHECKBOX: - X:448 - Y:2 - Width:20 - Height:20 - Image@STATUS_IMAGE: - Visible:false - X:450 - Y:4 - Width:20 - Height:20 - ImageCollection:checkbox-bits - ImageName:checked Container@TEMPLATE_NONEDITABLE_SPECTATOR: X:5 Y:0 @@ -354,20 +341,12 @@ Background@SERVER_LOBBY: Height:13 Label@SPECTATOR: Text:Spectator - Width:198 + Width:225 Height:25 - X:240 + X:245 Y:0 Align:Center Font:Bold - Image@STATUS_IMAGE: - Visible:false - X:450 - Y:4 - Width:20 - Height:20 - ImageCollection:checkbox-bits - ImageName:checked Container@TEMPLATE_NEW_SPECTATOR: X:5 Y:0 diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index 84729ad0d4..3cc144e14a 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -286,25 +286,12 @@ Background@SERVER_LOBBY: Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:198 + Width:225 Height:25 - X:240 + X:245 Y:0 Align:Center Font:Bold - Checkbox@STATUS_CHECKBOX: - X:448 - Y:2 - Width:20 - Height:20 - Image@STATUS_IMAGE: - Visible:false - X:450 - Y:4 - Width:20 - Height:20 - ImageCollection:checkbox-bits - ImageName:checked Container@TEMPLATE_NONEDITABLE_SPECTATOR: X:5 Y:0 @@ -354,20 +341,12 @@ Background@SERVER_LOBBY: Height:13 Label@SPECTATOR: Text:Spectator - Width:198 + Width:225 Height:25 - X:240 + X:245 Y:0 Align:Center Font:Bold - Image@STATUS_IMAGE: - Visible:false - X:450 - Y:4 - Width:20 - Height:20 - ImageCollection:checkbox-bits - ImageName:checked Container@TEMPLATE_NEW_SPECTATOR: X:5 Y:0 From 1fce900801f8b06daa569c9b42bfa1e158b4d24b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 26 Jun 2013 22:26:17 +1200 Subject: [PATCH 3/3] Set spectator color to white & remove selector. --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 5 ++-- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 2 -- mods/cnc/chrome/lobby.yaml | 25 ++++---------------- mods/d2k/chrome/lobby.yaml | 24 ++++--------------- mods/ra/chrome/lobby.yaml | 24 ++++--------------- 5 files changed, 15 insertions(+), 65 deletions(-) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index 80169c5309..b69ad28a3d 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -137,6 +137,7 @@ namespace OpenRA.Mods.RA.Server { client.Slot = null; client.SpawnPoint = 0; + client.Color = HSLColor.FromRGB(255, 255, 255); server.SyncLobbyInfo(); return true; }}, @@ -530,8 +531,8 @@ namespace OpenRA.Mods.RA.Server if (targetClient.Index != client.Index && !client.IsAdmin) return true; - // Map has disabled color changes - if (targetClient.Slot != null && server.lobbyInfo.Slots[targetClient.Slot].LockColor) + // Spectator or map has disabled color changes + if (targetClient.Slot == null || server.lobbyInfo.Slots[targetClient.Slot].LockColor) return true; var ci = parts[1].Split(',').Select(cc => int.Parse(cc)).ToArray(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 3a7a9febba..199d0e6909 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -459,7 +459,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic template = EditableSpectatorTemplate.Clone(); LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager); - LobbyUtils.SetupEditableColorWidget(template, null, c, orderManager, colorPreview); } // Non-editable spectator else @@ -469,7 +468,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupNameWidget(template, null, client); LobbyUtils.SetupKickWidget(template, null, client, orderManager); - LobbyUtils.SetupColorWidget(template, null, client); } LobbyUtils.SetupClientWidget(template, null, c, orderManager, true); diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index 0410b00c54..cbf3380d14 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -295,23 +295,11 @@ Container@SERVER_LOBBY: Width:190 Height:25 MaxLength:16 - DropDownButton@COLOR: - Width:70 - Height:25 - X:210 - Font:Regular - IgnoreChildMouseOver: true - Children: - ColorBlock@COLORBLOCK: - X:5 - Y:6 - Width:PARENT_RIGHT-35 - Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:250 + Width:315-55 Height:25 - X:255 + X:210 Y:0 Align:Center Font:Bold @@ -358,16 +346,11 @@ Container@SERVER_LOBBY: X:180 Y:2 Font:Bold - ColorBlock@COLORBLOCK: - X:215 - Y:6 - Width:35 - Height:13 Label@SPECTATOR: Text:Spectator - Width:250 + Width:315-55 Height:25 - X:255 + X:210 Y:0 Align:Center Font:Bold diff --git a/mods/d2k/chrome/lobby.yaml b/mods/d2k/chrome/lobby.yaml index e9318f10ab..96f93f4682 100644 --- a/mods/d2k/chrome/lobby.yaml +++ b/mods/d2k/chrome/lobby.yaml @@ -273,22 +273,11 @@ Background@SERVER_LOBBY: Width:135 Height:25 MaxLength:16 - DropDownButton@COLOR: - Width:80 - Height:25 - X:160 - Font:Regular - Children: - ColorBlock@COLORBLOCK: - X:5 - Y:6 - Width:PARENT_RIGHT-35 - Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:225 + Width:278 Height:25 - X:245 + X:160 Y:0 Align:Center Font:Bold @@ -334,16 +323,11 @@ Background@SERVER_LOBBY: X:125 Y:2 Font:Bold - ColorBlock@COLORBLOCK: - X:165 - Y:6 - Width:45 - Height:13 Label@SPECTATOR: Text:Spectator - Width:225 + Width:278 Height:25 - X:245 + X:160 Y:0 Align:Center Font:Bold diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index 3cc144e14a..5a2c39ddfc 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -273,22 +273,11 @@ Background@SERVER_LOBBY: Width:135 Height:25 MaxLength:16 - DropDownButton@COLOR: - Width:80 - Height:25 - X:160 - Font:Regular - Children: - ColorBlock@COLORBLOCK: - X:5 - Y:6 - Width:PARENT_RIGHT-35 - Height:PARENT_BOTTOM-12 Label@SPECTATOR: Text:Spectator - Width:225 + Width:278 Height:25 - X:245 + X:160 Y:0 Align:Center Font:Bold @@ -334,16 +323,11 @@ Background@SERVER_LOBBY: X:125 Y:2 Font:Bold - ColorBlock@COLORBLOCK: - X:165 - Y:6 - Width:45 - Height:13 Label@SPECTATOR: Text:Spectator - Width:225 + Width:278 Height:25 - X:245 + X:160 Y:0 Align:Center Font:Bold