diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index 1e3bc30bcc..9305dbf739 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -29,7 +29,7 @@ namespace OpenRA public bool? Shroud; public bool? FragileAlliances; public bool ConfigurableStartingUnits = true; - public string[] Difficulties; + public string[] Difficulties = { }; public void UpdateServerSettings(Session.Global settings) { diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index c9db7aa6ee..68628381b3 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -446,7 +446,7 @@ namespace OpenRA.Mods.RA.Server return true; } - if ((server.Map.Options.Difficulties == null && s != null) || (server.Map.Options.Difficulties != null && !server.Map.Options.Difficulties.Contains(s))) + if (s != null && !server.Map.Options.Difficulties.Contains(s)) { server.SendOrderTo(conn, "Message", "Unsupported difficulty selected: {0}".F(s)); server.SendOrderTo(conn, "Message", "Supported difficulties: {0}".F(server.Map.Options.Difficulties.JoinWith(","))); @@ -674,12 +674,14 @@ namespace OpenRA.Mods.RA.Server static void SetDefaultDifficulty(S server) { - if (server.Map.Options.Difficulties != null && server.Map.Options.Difficulties.Any()) + if (!server.Map.Options.Difficulties.Any()) { - if (!server.Map.Options.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty)) - server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First(); + server.lobbyInfo.GlobalSettings.Difficulty = null; + return; } - else server.lobbyInfo.GlobalSettings.Difficulty = null; + + if (!server.Map.Options.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty)) + server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First(); } } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index b0c5d1ce20..a8bbac988a 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -298,7 +298,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var difficulty = optionsBin.GetOrNull("DIFFICULTY_DROPDOWNBUTTON"); if (difficulty != null) { - difficulty.IsVisible = () => Map.Options.Difficulties != null && Map.Options.Difficulties.Any(); + difficulty.IsVisible = () => Map.Options.Difficulties.Any(); difficulty.IsDisabled = configurationDisabled; difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty; difficulty.OnMouseDown = _ => @@ -335,9 +335,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic var classes = Rules.Info["world"].Traits.WithInterface() .Select(a => a.Class).Distinct(); - startingUnits.IsDisabled = configurationDisabled; - startingUnits.IsVisible = () => Map.Options.ConfigurableStartingUnits; - startingUnits.GetText = () => className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass); + startingUnits.IsDisabled = () => !Map.Options.ConfigurableStartingUnits || configurationDisabled(); + startingUnits.GetText = () => !Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass); startingUnits.OnMouseDown = _ => { var options = classes.Select(c => new DropDownOption diff --git a/mods/cnc/chrome/dialogs.yaml b/mods/cnc/chrome/dialogs.yaml index a0ebdc245a..5d2c15a685 100644 --- a/mods/cnc/chrome/dialogs.yaml +++ b/mods/cnc/chrome/dialogs.yaml @@ -206,57 +206,66 @@ Background@LOBBY_OPTIONS_BIN: Children: Label@TITLE: X:0 - Y:40 + Y:30 Width:PARENT_RIGHT Height:25 Font:Bold Align:Center Text: Map Options - Checkbox@ALLOWCHEATS_CHECKBOX: - X:80 - Y:75 - Width:230 - Height:20 - Text:Cheats / Debug Menu - Checkbox@CRATES_CHECKBOX: - X:80 - Y:110 - Width:230 - Height:20 - Text:Crates - Checkbox@SHROUD_CHECKBOX: - X:310 - Y:75 - Width:230 - Height:20 - Text:Shroud - Checkbox@FOG_CHECKBOX: - X:310 - Y:110 - Width:230 - Height:20 - Text:Fog of War - Label@STARTINGUNITS_DESC: - X:135 - Y:142 - Width:120 - Height:25 - Text:Starting Units: - DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: - X:230 - Y:142 - Width:140 - Height:25 - Font:Bold - Label@DIFFICULTY_DESC: - X:125 - Y:177 - Width:120 - Height:25 - Text:Mission Difficulty: - DropDownButton@DIFFICULTY_DROPDOWNBUTTON: - X:230 - Y:177 - Width:100 - Height:25 - Font:Bold + Container: + X:20 + Y:65 + Width: PARENT_RIGHT-40 + Height: PARENT_BOTTOM-75 + Children: + Checkbox@ALLOWCHEATS_CHECKBOX: + Width:230 + Height:20 + Text:Debug Menu + Checkbox@FRAGILEALLIANCES_CHECKBOX: + Y:35 + Width:220 + Height:20 + Text:Team Changes + Checkbox@SHROUD_CHECKBOX: + X:155 + Width:230 + Height:20 + Text:Shroud + Checkbox@FOG_CHECKBOX: + X:155 + Y:35 + Width:230 + Height:20 + Text:Fog of War + Checkbox@CRATES_CHECKBOX: + X:280 + Width:230 + Height:20 + Text:Crates Appear + Label@STARTINGUNITS_DESC: + X:PARENT_RIGHT - WIDTH - 145 + Y:72 + Width:120 + Height:25 + Text:Starting Units: + Align:Right + DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: + X:PARENT_RIGHT - WIDTH + Y:72 + Width:140 + Height:25 + Font:Bold + Label@DIFFICULTY_DESC: + X:PARENT_RIGHT - WIDTH - 145 + Y:107 + Width:120 + Height:25 + Text:Mission Difficulty: + Align:Right + DropDownButton@DIFFICULTY_DROPDOWNBUTTON: + X:PARENT_RIGHT - WIDTH + Y:107 + Width:140 + Height:25 + Font:Bold \ No newline at end of file diff --git a/mods/ra/chrome/lobby-dialogs.yaml b/mods/ra/chrome/lobby-dialogs.yaml index f26378c3b4..249fce701d 100644 --- a/mods/ra/chrome/lobby-dialogs.yaml +++ b/mods/ra/chrome/lobby-dialogs.yaml @@ -59,63 +59,66 @@ Background@LOBBY_OPTIONS_BIN: Children: Label@TITLE: X:0 - Y:40 + Y:30 Width:PARENT_RIGHT Height:25 Font:Bold Align:Center Text: Map Options - Checkbox@ALLOWCHEATS_CHECKBOX: - X:80 - Y:75 - Width:230 - Height:20 - Text:Cheats / Debug Menu - Checkbox@FRAGILEALLIANCES_CHECKBOX: - X:80 - Y:110 - Width:220 - Height:20 - Text:Allow Team Changes - Checkbox@CRATES_CHECKBOX: - X:80 - Y:145 - Width:230 - Height:20 - Text:Crates - Checkbox@SHROUD_CHECKBOX: - X:310 - Y:75 - Width:230 - Height:20 - Text:Shroud - Checkbox@FOG_CHECKBOX: - X:310 - Y:110 - Width:230 - Height:20 - Text:Fog of War - Label@STARTINGUNITS_DESC: - X:215 - Y:142 - Width:120 - Height:25 - Text:Starting Units: - DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: - X:310 - Y:142 - Width:140 - Height:25 - Font:Bold - Label@DIFFICULTY_DESC: - X:195 - Y:177 - Width:120 - Height:25 - Text:Mission Difficulty: - DropDownButton@DIFFICULTY_DROPDOWNBUTTON: - X:310 - Y:177 - Width:100 - Height:25 - Font:Bold + Container: + X:30 + Y:70 + Width: PARENT_RIGHT-60 + Height: PARENT_BOTTOM-75 + Children: + Checkbox@ALLOWCHEATS_CHECKBOX: + Width:230 + Height:20 + Text:Debug Menu + Checkbox@FRAGILEALLIANCES_CHECKBOX: + Y:40 + Width:220 + Height:20 + Text:Team Changes + Checkbox@SHROUD_CHECKBOX: + X:175 + Width:230 + Height:20 + Text:Shroud + Checkbox@FOG_CHECKBOX: + X:175 + Y:40 + Width:230 + Height:20 + Text:Fog of War + Checkbox@CRATES_CHECKBOX: + X:310 + Width:230 + Height:20 + Text:Crates Appear + Label@STARTINGUNITS_DESC: + X:PARENT_RIGHT - WIDTH - 145 + Y:87 + Width:120 + Height:25 + Text:Starting Units: + Align:Right + DropDownButton@STARTINGUNITS_DROPDOWNBUTTON: + X:PARENT_RIGHT - WIDTH + Y:87 + Width:140 + Height:25 + Font:Bold + Label@DIFFICULTY_DESC: + X:PARENT_RIGHT - WIDTH - 145 + Y:122 + Width:120 + Height:25 + Text:Mission Difficulty: + Align:Right + DropDownButton@DIFFICULTY_DROPDOWNBUTTON: + X:PARENT_RIGHT - WIDTH + Y:122 + Width:140 + Height:25 + Font:Bold