From c4332c808b049c5db1564d4a36d7b62ec6111844 Mon Sep 17 00:00:00 2001 From: Ashley Newson Date: Fri, 30 May 2025 21:27:38 +0100 Subject: [PATCH] Fix copy-paste editor crash for RectangularIsometric EditorBlit was incorrectly using CellRegion.Contains instead of CellRegion.CellCoords.Contains (i.e. CellCoordsRegion.Contains). This resulted in a crash upon attempting to paste within the editor for RectangularIsometric maps (such as in TS). This change updates the code to use the correct region type and fixes the crash. --- OpenRA.Mods.Common/EditorBrushes/EditorBlit.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorBlit.cs b/OpenRA.Mods.Common/EditorBrushes/EditorBlit.cs index 71bca90ffe..8488ec453e 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorBlit.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorBlit.cs @@ -275,9 +275,11 @@ namespace OpenRA.Mods.Common.EditorBrushes { var mask = new HashSet(); + var sourceCellCoords = blitSource.CellRegion.CellCoords; + foreach (var (cpos, _) in blitSource.Tiles) { - if (!blitSource.CellRegion.Contains(cpos)) + if (!sourceCellCoords.Contains(cpos)) throw new ArgumentException("EditorBlitSource contains a BlitTile outside of its CellRegion"); mask.Add(cpos + offset); } @@ -286,11 +288,13 @@ namespace OpenRA.Mods.Common.EditorBrushes { var anyContained = false; foreach (var cpos in editorActorPreview.Footprint.Keys) - if (blitSource.CellRegion.Contains(cpos)) + { + if (sourceCellCoords.Contains(cpos)) { mask.Add(cpos + offset); anyContained = true; } + } if (!anyContained) throw new ArgumentException("EditorBlitSource contains an actor entirely outside of its CellRegion");