fix(#905): make sure burg0 is not getting locked [v.1.88.05]

This commit is contained in:
Azgaar 2022-12-15 15:43:40 +03:00
parent ce07c20fff
commit 3883933385
5 changed files with 15 additions and 6 deletions

View file

@ -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 &&

View file

@ -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;
});
}

View file

@ -261,7 +261,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);