mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
feat: add compactPackData function to filter out undefined glaciers and icebergs
This commit is contained in:
parent
d1250b4c00
commit
eb78b332a6
1 changed files with 8 additions and 0 deletions
|
|
@ -38,6 +38,12 @@ 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";
|
||||||
|
|
@ -89,6 +95,8 @@ 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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue