fix: remove corrupted burg of load

This commit is contained in:
Azgaar 2022-06-25 14:46:26 +03:00
parent ba0a7516ef
commit 6e95ee1be8
4 changed files with 13 additions and 7 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
.bat
.vscode
.idea
.idea/Fantasy-Map-Generator.iml
.DS_Store

View file

@ -7861,7 +7861,7 @@
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
<script defer src="modules/io/save.js"></script>
<script defer src="modules/io/load.js?v=1.87.00"></script>
<script defer src="modules/io/load.js?v=1.87.05"></script>
<script defer src="modules/io/cloud.js"></script>
<script defer src="modules/io/export.js"></script>
<script defer src="modules/io/formats.js"></script>

View file

@ -439,10 +439,8 @@ async function parseLoadedData(data) {
const cells = pack.cells;
if (pack.cells.i.length !== pack.cells.state.length) {
ERROR &&
console.error(
"Striping issue. Map data is corrupted. The only solution is to edit the heightmap in erase mode"
);
const message = "Data Integrity Check. Striping issue. To fix edit the heightmap in erase mode";
ERROR && console.error(message);
}
const invalidStates = [...new Set(cells.state)].filter(s => !pack.states[s] || pack.states[s].removed);
@ -501,6 +499,14 @@ async function parseLoadedData(data) {
pack.burgs.forEach(burg => {
if (!burg.i || burg.removed) return;
if (burg.cell === undefined || burg.x === undefined || burg.y === undefined) {
ERROR &&
console.error(
`Data Integrity Check. Burg ${burg.i} is missing cell info or coordinates. Removing the burg`
);
burg.removed = true;
}
if (burg.port < 0) {
ERROR && console.error("Data Integrity Check. Burg", burg.i, "has invalid port value", burg.port);
burg.port = 0;

View file

@ -1,7 +1,7 @@
"use strict";
// version and caching control
const version = "1.87.04"; // generator version, update each time
const version = "1.87.05"; // generator version, update each time
{
document.title += " v" + version;