From 2246922118785c8ed60f2196c23579b558cc6746 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 28 Dec 2025 17:26:53 +0000 Subject: [PATCH] Fix lobby crash if a map's DefaultCash isn't Selectable. --- OpenRA.Mods.Common/Traits/Player/PlayerResources.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs index 9c78517941..6680affd16 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlayerResources.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Tooltip description for the starting cash option in the lobby.")] public readonly string DefaultCashDropdownDescription = "The amount of cash that players start with"; - [Desc("Starting cash options that are available in the lobby options.")] + [Desc("Starting cash options that are available in the lobby options. DefaultCash will be included if not specified.")] public readonly ImmutableArray SelectableCash = [2500, 5000, 10000, 20000]; [Desc("Default starting cash option: should be one of the SelectableCash options.")] @@ -65,7 +65,9 @@ namespace OpenRA.Mods.Common.Traits IEnumerable ILobbyOptions.LobbyOptions(MapPreview map) { - var startingCash = SelectableCash.ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo)); + // Make sure that DefaultCash is included in the available options + var startingCash = SelectableCash.Append(DefaultCash).ToHashSet() + .ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo)); if (startingCash.Count > 0) yield return new LobbyOption(map, "startingcash",