From 32b2762f6c3d83147841a05686e2da4b48ba2a5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 22:18:34 +0000 Subject: [PATCH] Use local Map for zone backup instead of mutating zone objects Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> --- public/modules/ui/heightmap-editor.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/modules/ui/heightmap-editor.js b/public/modules/ui/heightmap-editor.js index d98c1c3f..e204055a 100644 --- a/public/modules/ui/heightmap-editor.js +++ b/public/modules/ui/heightmap-editor.js @@ -330,9 +330,10 @@ function editHeightmap(options) { c.y = p[1]; } + const zoneGridCellsMap = new Map(); for (const zone of pack.zones) { if (!zone.cells || !zone.cells.length) continue; - zone.gridCells = zone.cells.map(i => pack.cells.g[i]); + zoneGridCellsMap.set(zone.i, zone.cells.map(i => pack.cells.g[i])); } Features.markupGrid(); @@ -451,9 +452,9 @@ function editHeightmap(options) { } for (const zone of pack.zones) { - if (!zone.gridCells || !zone.gridCells.length) continue; - zone.cells = zone.gridCells.flatMap(g => gridToPackMap.get(g) || []); - delete zone.gridCells; + const gridCells = zoneGridCellsMap.get(zone.i); + if (!gridCells || !gridCells.length) continue; + zone.cells = gridCells.flatMap(g => gridToPackMap.get(g) || []); } // recalculate ice