Fix tileset templates to appear in the map editor in their order in YAML.

Fixes regression from 649e7e8c28. When the Templates was changed from a Dictionary to a FrozenDictionary, this caused the items to be reordered. Some code was relying on the previous behaviour where the Dictionary ordering would happen to remain the same as the YAML input.

Fix this by creating a TemplatesInDefinitionOrder which can be used to iterate in the same ordering as given in YAML. Code that depends on the ordering can use this, and other code that does lookups can use the FrozenDictionary.
This commit is contained in:
RoosterDragon
2025-12-31 21:46:05 +00:00
committed by Paul Chote
parent 2c0a4f5873
commit c47ebfbb52
6 changed files with 24 additions and 22 deletions

View File

@@ -341,7 +341,7 @@ namespace OpenRA.Mods.Common.Traits
World = self.World;
TraitInfo = info;
var templatedTerrainInfo = World.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
var templatedTerrainInfo = (ITemplatedTerrainInfo)World.Map.Rules.TerrainInfo;
SegmentedBrushes =
templatedTerrainInfo.MultiBrushCollections.Keys
.Order()