Repository navigation
Fix map editor copy-paste for isometric maps. - #21446
Merged
Merged
Conversation
RoosterDragon
force-pushed
the
fix-iso-copy
branch
3 times, most recently
from
June 15, 2024 10:35
617c3d6 to
b3527fa
Compare
PunkPun
reviewed
Jun 15, 2024
PunkPun
left a comment
Member
There was a problem hiding this comment.
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
force-pushed
the
fix-iso-copy
branch
from
June 15, 2024 12:40
b3527fa to
29bcbf8
Compare
Member
Author
|
Corrected now - I messed up a rebase. |
PunkPun
approved these changes
Jun 15, 2024
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
After - the wall is now included in the copy, as expected.