mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix rebels #779
This commit is contained in:
parent
73434f5bb7
commit
424e1f4d85
1 changed files with 21 additions and 19 deletions
18
main.js
18
main.js
|
|
@ -241,7 +241,8 @@ async function checkLoadParameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// open latest map if option is active and map is stored
|
// open latest map if option is active and map is stored
|
||||||
const loadLastMap = () => new Promise((resolve, reject) => {
|
const loadLastMap = () =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
ldb.get("lastMap", blob => {
|
ldb.get("lastMap", blob => {
|
||||||
if (blob) {
|
if (blob) {
|
||||||
WARN && console.warn("Load last saved map");
|
WARN && console.warn("Load last saved map");
|
||||||
|
|
@ -254,13 +255,13 @@ async function checkLoadParameters() {
|
||||||
} else {
|
} else {
|
||||||
reject("No map stored");
|
reject("No map stored");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
if (onloadMap.value === "saved") {
|
if (onloadMap.value === "saved") {
|
||||||
try {
|
try {
|
||||||
await loadLastMap();
|
await loadLastMap();
|
||||||
} catch(error) {
|
} catch (error) {
|
||||||
ERROR && console.error(error);
|
ERROR && console.error(error);
|
||||||
WARN && console.warn("Cannot load stored map, random map to be generated");
|
WARN && console.warn("Cannot load stored map, random map to be generated");
|
||||||
await generateMapOnLoad();
|
await generateMapOnLoad();
|
||||||
|
|
@ -1625,10 +1626,11 @@ function addZones(number = 1) {
|
||||||
const neib = ra(state.neighbors.filter(n => n && !states[n].removed));
|
const neib = ra(state.neighbors.filter(n => n && !states[n].removed));
|
||||||
if (!neib) return;
|
if (!neib) return;
|
||||||
const cell = cells.i.find(i => cells.state[i] === state.i && !state.removed && cells.c[i].some(c => cells.state[c] === neib));
|
const cell = cells.i.find(i => cells.state[i] === state.i && !state.removed && cells.c[i].some(c => cells.state[c] === neib));
|
||||||
const cellsArray = [],
|
const cellsArray = [];
|
||||||
queue = [],
|
const queue = [];
|
||||||
power = rand(10, 30);
|
if (cell) queue.push(cell);
|
||||||
if (cell) queue.push.cell;
|
|
||||||
|
const power = rand(10, 30);
|
||||||
|
|
||||||
while (queue.length) {
|
while (queue.length) {
|
||||||
const q = queue.shift();
|
const q = queue.shift();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue