Skip to content

Fix map editor copy-paste for isometric maps. - #21446

Merged
PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:fix-iso-copy
Jun 15, 2024
Merged

PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:fix-iso-copy

Conversation

@RoosterDragon

@RoosterDragon RoosterDragon commented Jun 14, 2024 •

Copy link
Copy Markdown
Member

When dealing with isometric maps, the copy paste region needs to copy the CellCoords area covered by the CellRegion. This is equivalent to the selected rectangle on screen. Using the cell region itself invokes cell->map->cell conversion that doesn't roundtrip and thus some of the selected cells don't get copied.

Also when pasting terrain + actors, we need to fix the sequencing to clear actors on the current terrain, before adjusting the height and pasting in new actors. The current sequencing means we are clearing actors after having adjusted the terrain height, and affects the wrong area.

Fixes #21433.


Before - notice the wall on the left of the selection is not copied.

image

After - the wall is now included in the copy, as expected.

image

@PunkPun PunkPun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm I do the same action as in #21433 I now get the crash

Exception of type `System.ArgumentException`: An item with the same key has already been added. Key: nawall Actor14
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at OpenRA.Mods.Common.Traits.EditorActorLayer.Add(EditorActorPreview preview, Boolean initialSetup) in /GitHub/OpenRA/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs:line 148
   at OpenRA.Mods.Common.Widgets.CopyPasteEditorAction.Undo() in /GitHub/OpenRA/OpenRA.Mods.Common/EditorBrushes/EditorCopyPasteBrush.cs:line 277

When dealing with isometric maps, the copy paste region needs to copy the CellCoords area covered by the CellRegion. This is equivalent to the selected rectangle on screen. Using the cell region itself invokes cell->map->cell conversion that doesn't roundtrip and thus some of the selected cells don't get copied.

Also when pasting terrain + actors, we need to fix the sequencing to clear actors on the current terrain, before adjusting the height and pasting in new actors. The current sequencing means we are clearing actors after having adjusted the terrain height, and affects the wrong area.
@RoosterDragon

Copy link
Copy Markdown
Member Author

Corrected now - I messed up a rebase.

@PunkPun
PunkPun merged commit cac0438 into OpenRA:bleed Jun 15, 2024
@PunkPun

PunkPun commented Jun 15, 2024

Copy link
Copy Markdown
Member

changelog

@RoosterDragon
RoosterDragon deleted the fix-iso-copy branch June 15, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor sometimes doesn't copypaste actors correctly and crashes

2 participants