diff --git a/changelog.md b/changelog.md index 859097c..2122d2d 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ - Tree branches can have custom line widths. - If an upgrade has both canAfford and cost, it checks both. (So you can use canAfford for other things) - Releasing a held buyable/clickable with onHold doesn't click it again. +- Fixed hard resetting while NaN'ed and exporting NaN saves for debugging. - Attempt to fix buttons sometimes not updating. - Improvements to theme code, partially by Cubedey. diff --git a/js/game.js b/js/game.js index 7ad2765..73bcc12 100644 --- a/js/game.js +++ b/js/game.js @@ -396,7 +396,7 @@ function hardReset(resetOptions) { if (!confirm("Are you sure you want to do this? You will lose all your progress!")) return player = null if(resetOptions) options = null - save(); + save(true); window.location.reload(); } diff --git a/js/utils/save.js b/js/utils/save.js index 6d5b32d..845f503 100644 --- a/js/utils/save.js +++ b/js/utils/save.js @@ -1,7 +1,7 @@ // ************ Save stuff ************ -function save() { +function save(force) { NaNcheck(player) - if (NaNalert) return + if (NaNalert && !force) return localStorage.setItem(modInfo.id, btoa(unescape(encodeURIComponent(JSON.stringify(player))))); localStorage.setItem(modInfo.id+"_options", btoa(unescape(encodeURIComponent(JSON.stringify(options))))); @@ -257,7 +257,7 @@ function NaNcheck(data) { } } function exportSave() { - if (NaNalert) return + //if (NaNalert) return let str = btoa(JSON.stringify(player)); const el = document.createElement("textarea"); @@ -279,6 +279,7 @@ function importSave(imported = undefined, forced = false) { player.versionType = modInfo.id; fixSave(); versionCheck(); + NaNcheck(save) save(); window.location.reload(); } catch (e) {