diff --git a/index.html b/index.html
index de51b89e..e05c060e 100644
--- a/index.html
+++ b/index.html
@@ -7849,7 +7849,7 @@
-
+
@@ -7903,7 +7903,7 @@
-
+
diff --git a/modules/io/load.js b/modules/io/load.js
index a4ff11ea..cd1ed8c0 100644
--- a/modules/io/load.js
+++ b/modules/io/load.js
@@ -500,6 +500,15 @@ async function parseLoadedData(data) {
});
pack.burgs.forEach(burg => {
+ if ((!burg.i || burg.removed) && burg.lock) {
+ ERROR &&
+ console.error(
+ `Data Integrity Check. Burg ${burg.i || "0"} is removed or invalid but still locked. Unlocking the burg`
+ );
+ delete burg.lock;
+ return;
+ }
+
if (!burg.i || burg.removed) return;
if (burg.cell === undefined || burg.x === undefined || burg.y === undefined) {
ERROR &&
diff --git a/modules/submap.js b/modules/submap.js
index 85408487..41cdf74b 100644
--- a/modules/submap.js
+++ b/modules/submap.js
@@ -403,7 +403,7 @@ window.Submap = (function () {
} else {
b.cell = cityCell;
}
- if (!b.lock) b.lock = options.lockBurgs;
+ if (b.i && !b.lock) b.lock = options.lockBurgs;
cells.burg[b.cell] = id;
});
}
diff --git a/modules/ui/tools.js b/modules/ui/tools.js
index cc669af6..0c0c5d78 100644
--- a/modules/ui/tools.js
+++ b/modules/ui/tools.js
@@ -176,7 +176,7 @@ function regenerateProvinces() {
function regenerateBurgs() {
const {cells, states} = pack;
- const lockedburgs = pack.burgs.filter(b => b.lock);
+ const lockedburgs = pack.burgs.filter(b => b.i && !b.removed && b.lock);
rankCells();
cells.burg = new Uint16Array(cells.i.length);