mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
fix compact problems on autosave
This commit is contained in:
parent
9db2f708ec
commit
a7d9fb3242
1 changed files with 4 additions and 8 deletions
|
|
@ -39,11 +39,6 @@ async function saveMap(method) {
|
||||||
|
|
||||||
function prepareMapData() {
|
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 date = new Date();
|
||||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
||||||
const license = "File can be loaded in azgaar.github.io/Fantasy-Map-Generator";
|
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);
|
const serializedSVG = new XMLSerializer().serializeToString(cloneEl);
|
||||||
|
|
||||||
compactPackData();
|
|
||||||
|
|
||||||
const {spacing, cellsX, cellsY, boundary, points, features, cellsDesired} = grid;
|
const {spacing, cellsX, cellsY, boundary, points, features, cellsDesired} = grid;
|
||||||
const gridGeneral = JSON.stringify({spacing, cellsX, cellsY, boundary, points, features, cellsDesired});
|
const gridGeneral = JSON.stringify({spacing, cellsX, cellsY, boundary, points, features, cellsDesired});
|
||||||
const packFeatures = JSON.stringify(pack.features);
|
const packFeatures = JSON.stringify(pack.features);
|
||||||
|
|
@ -110,7 +103,10 @@ function prepareMapData() {
|
||||||
const cellRoutes = JSON.stringify(pack.cells.routes);
|
const cellRoutes = JSON.stringify(pack.cells.routes);
|
||||||
const routes = JSON.stringify(pack.routes);
|
const routes = JSON.stringify(pack.routes);
|
||||||
const zones = JSON.stringify(pack.zones);
|
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
|
// store name array only if not the same as default
|
||||||
const defaultNB = Names.getNameBases();
|
const defaultNB = Names.getNameBases();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue