diff --git a/OpenRA.Game/Chrome.cs b/OpenRA.Game/Chrome.cs index c85b4c0949..b6a5f370e8 100644 --- a/OpenRA.Game/Chrome.cs +++ b/OpenRA.Game/Chrome.cs @@ -24,7 +24,6 @@ using System.Drawing; using System.Linq; using OpenRA.FileFormats; using OpenRA.Graphics; -using OpenRA.Traits; using OpenRA.Widgets; namespace OpenRA diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index e3035f358d..b8b692fb56 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -398,6 +398,19 @@ namespace OpenRA.Server SyncLobbyInfo(); return true; }}, + { "lockteams", + s => + { + if (conn.PlayerIndex != 0) + { + SendChatTo( conn, "Only the host can set that option" ); + return true; + } + + bool.TryParse(s, out lobbyInfo.GlobalSettings.LockTeams); + SyncLobbyInfo(); + return true; + }}, }; var cmdName = cmd.Split(' ').First(); diff --git a/OpenRA.Game/Widgets/CheckboxWidget.cs b/OpenRA.Game/Widgets/CheckboxWidget.cs index 656cb77174..2e49035c7b 100644 --- a/OpenRA.Game/Widgets/CheckboxWidget.cs +++ b/OpenRA.Game/Widgets/CheckboxWidget.cs @@ -18,8 +18,8 @@ */ #endregion -using System.Drawing; using System; +using System.Drawing; namespace OpenRA.Widgets { diff --git a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs index 2dcd230e2e..f13592fbfd 100644 --- a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with OpenRA. If not, see . */ -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Drawing; +#endregion + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; using OpenRA.FileFormats; namespace OpenRA.Widgets.Delegates @@ -54,7 +54,19 @@ namespace OpenRA.Widgets.Delegates disconnectButton.OnMouseUp = mi => { Game.Disconnect(); return true; + }; + + var lockTeamsCheckbox = lobby.GetWidget("LOCKTEAMS_CHECKBOX") as CheckboxWidget; + lockTeamsCheckbox.IsVisible = () => true; + lockTeamsCheckbox.Checked = () => Game.LobbyInfo.GlobalSettings.LockTeams; + lockTeamsCheckbox.OnMouseDown = mi => + { + if (Game.IsHost) + Game.IssueOrder(Order.Chat( + "/lockteams {0}".F(!Game.LobbyInfo.GlobalSettings.LockTeams))); + return true; }; + Game.LobbyInfoChanged += UpdatePlayerList; } diff --git a/mods/ra/menus.yaml b/mods/ra/menus.yaml index b9d0dc21f4..f6998b10b3 100644 --- a/mods/ra/menus.yaml +++ b/mods/ra/menus.yaml @@ -496,7 +496,7 @@ Container: Visible: true X: PARENT_RIGHT-300 Y: PARENT_BOTTOM-38 - Width: 100 + Width: 80 Height: 20 Text: Lock Teams Button@DISCONNECT_BUTTON: