mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 23:57:23 +01:00
Use local Map for zone backup instead of mutating zone objects
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
parent
09a4f17270
commit
32b2762f6c
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue