mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
feat: streamline saving options
This commit is contained in:
parent
2424c66475
commit
5300b997b3
7 changed files with 104 additions and 69 deletions
19
main.js
19
main.js
|
|
@ -292,17 +292,20 @@ async function checkLoadParameters() {
|
|||
}
|
||||
|
||||
// check if there is a map saved to indexedDB
|
||||
try {
|
||||
const blob = await ldb.get("lastMap");
|
||||
if (blob) {
|
||||
WARN && console.warn("Loading last stored map");
|
||||
uploadMap(blob);
|
||||
return;
|
||||
if (byId("onloadBehavior").value === "lastSaved") {
|
||||
try {
|
||||
const blob = await ldb.get("lastMap");
|
||||
if (blob) {
|
||||
WARN && console.warn("Loading last stored map");
|
||||
uploadMap(blob);
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
ERROR && console.error(error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
// else generate random map
|
||||
WARN && console.warn("Generate random map");
|
||||
generateMapOnLoad();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue