From a7d9fb32425bda6fb8729c9b0b7233aae5bd6e9d Mon Sep 17 00:00:00 2001 From: StempunkDev Date: Thu, 15 Jan 2026 00:11:59 +0100 Subject: [PATCH] fix compact problems on autosave --- public/modules/io/save.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/public/modules/io/save.js b/public/modules/io/save.js index fd69f495..33ded975 100644 --- a/public/modules/io/save.js +++ b/public/modules/io/save.js @@ -39,11 +39,6 @@ async function saveMap(method) { function prepareMapData() { - function compactPackData() { - // Place all the compaction functions here - pack.ice.glaciers = pack.ice.glaciers.filter(g => g !== undefined); - pack.ice.icebergs = pack.ice.icebergs.filter(i => i !== undefined); - } const date = new Date(); const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(); const license = "File can be loaded in azgaar.github.io/Fantasy-Map-Generator"; @@ -95,8 +90,6 @@ function prepareMapData() { const serializedSVG = new XMLSerializer().serializeToString(cloneEl); - compactPackData(); - const {spacing, cellsX, cellsY, boundary, points, features, cellsDesired} = grid; const gridGeneral = JSON.stringify({spacing, cellsX, cellsY, boundary, points, features, cellsDesired}); const packFeatures = JSON.stringify(pack.features); @@ -110,7 +103,10 @@ function prepareMapData() { const cellRoutes = JSON.stringify(pack.cells.routes); const routes = JSON.stringify(pack.routes); const zones = JSON.stringify(pack.zones); - const ice = JSON.stringify(pack.ice); + + const icebergs = pack.ice.icebergs.filter(iceberg => iceberg !== undefined); + const glaciers = pack.ice.glaciers.filter(glacier => glacier !== undefined); + const ice = JSON.stringify({icebergs, glaciers}); // store name array only if not the same as default const defaultNB = Names.getNameBases();