Skip to content

Commit 93f8634

Browse files
Fix clipboard flip scrambling sprites (struct regression)
- Write modified sprite tiles back to flippedBuffer after mutation - Tile struct conversion made read-modify sequences lose changes
1 parent c48fba1 commit 93f8634

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/TEdit.Editor/Clipboard/ClipboardBuffer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ public static ClipboardBuffer Flip(ClipboardBuffer buffer, bool flipX, bool rota
578578
curTile.Type = sprite.Tile;
579579
curTile.U = tiles[x, y].X;
580580
curTile.V = tiles[x, y].Y;
581+
flippedBuffer.Tiles[tilex, tiley] = curTile;
581582
}
582583
catch (Exception ex)
583584
{
@@ -608,6 +609,7 @@ public static ClipboardBuffer Flip(ClipboardBuffer buffer, bool flipX, bool rota
608609
targetTile.Type = sourceTile.Type;
609610
targetTile.U = sourceTile.U;
610611
targetTile.V = sourceTile.V;
612+
flippedBuffer.Tiles[targetX, targetY] = targetTile;
611613

612614
/*
613615
if (targetTile.Type == (uint)TileType.JunctionBox)

0 commit comments

Comments
 (0)