mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.60 - fix for burg assigned to not-existant state
This commit is contained in:
parent
9908188a51
commit
ffb9d2e5c3
1 changed files with 12 additions and 5 deletions
|
|
@ -1147,11 +1147,18 @@ function parseLoadedData(data) {
|
||||||
pack.burgs.forEach(b => {
|
pack.burgs.forEach(b => {
|
||||||
if (!b.i || b.removed) return;
|
if (!b.i || b.removed) return;
|
||||||
if (b.port < 0) {ERROR && console.error("Data Integrity Check. Burg", b.i, "has invalid port value", b.port); b.port = 0;}
|
if (b.port < 0) {ERROR && console.error("Data Integrity Check. Burg", b.i, "has invalid port value", b.port); b.port = 0;}
|
||||||
if (b.cell < cells.i.length) return;
|
|
||||||
ERROR && console.error("Data Integrity Check. Burg", b.i, "is linked to invalid cell", b.cell);
|
if (b.cell >= cells.i.length) {
|
||||||
b.cell = findCell(b.x, b.y);
|
ERROR && console.error("Data Integrity Check. Burg", b.i, "is linked to invalid cell", b.cell);
|
||||||
cells.i.filter(i => cells.burg[i] === b.i).forEach(i => cells.burg[i] = 0);
|
b.cell = findCell(b.x, b.y);
|
||||||
cells.burg[b.cell] = b.i;
|
cells.i.filter(i => cells.burg[i] === b.i).forEach(i => cells.burg[i] = 0);
|
||||||
|
cells.burg[b.cell] = b.i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.state && !pack.states[b.state]) {
|
||||||
|
ERROR && console.error("Data Integrity Check. Burg", b.i, "is linked to invalid state", b.state);
|
||||||
|
b.state = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
pack.provinces.forEach(p => {
|
pack.provinces.forEach(p => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue