From e022744b0ae21c52669cd3ebfaef594e6d140029 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 2 Mar 2025 08:50:13 +0000 Subject: [PATCH] Remove Map requirement from IMapGeneratorInfo.GetSettings. --- .../MapGenerator/MapGeneratorSettings.cs | 12 ++++++------ OpenRA.Mods.Common/Traits/World/ClearMapGenerator.cs | 4 ++-- OpenRA.Mods.Common/Traits/World/RaMapGenerator.cs | 4 ++-- OpenRA.Mods.Common/TraitsInterfaces.cs | 6 +++--- .../UtilityCommands/FuzzMapGeneratorCommand.cs | 2 +- .../Widgets/Logic/Editor/MapGeneratorToolLogic.cs | 4 +++- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs b/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs index a5b58a94ba..0941ad2ad6 100644 --- a/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs +++ b/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs @@ -89,9 +89,9 @@ namespace OpenRA.Mods.Common.MapGenerator } /// Check whether this choice is permitted for this map. - public bool Allowed(Map map) + public bool Allowed(ITerrainInfo terrainInfo) { - if (Tileset != null && !Tileset.Contains(map.Tileset)) + if (Tileset != null && !Tileset.Contains(terrainInfo.Id)) return false; return true; @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.MapGenerator /// Settings layering priority. Higher overrides lower. public readonly int Priority = 0; - public Option(string id, MiniYaml my, Map map) + public Option(string id, MiniYaml my, ITerrainInfo terrainInfo) { Id = id; FieldLoader.Load(this, my); @@ -214,7 +214,7 @@ namespace OpenRA.Mods.Common.MapGenerator if (split.Length >= 2) choiceId = split[1]; var choice = new Choice(choiceId, node.Value); - if (choice.Allowed(map)) + if (choice.Allowed(terrainInfo)) choices.Add(choice); } } @@ -334,7 +334,7 @@ namespace OpenRA.Mods.Common.MapGenerator /// /// Parse settings from a MiniYaml definition. Returns null if the map isn't compatible. /// - public static MapGeneratorSettings LoadSettings(MiniYaml my, Map map) + public static MapGeneratorSettings LoadSettings(MiniYaml my, ITerrainInfo terrainInfo) { var options = new List