| @@ -3,6 +3,10 @@ | |||||
| /*jshint browser: true*/ | /*jshint browser: true*/ | ||||
| /*jshint devel: true*/ | /*jshint devel: true*/ | ||||
| let version = "v0.7.4"; | |||||
| let save_version = 0; | |||||
| let errored = false; | let errored = false; | ||||
| window.onerror = function(msg, source, lineno, colno, error) { | window.onerror = function(msg, source, lineno, colno, error) { | ||||
| @@ -4150,6 +4154,9 @@ function loadSettings(settings = null) { | |||||
| settings = JSON.parse(storage.getItem('settings')); | settings = JSON.parse(storage.getItem('settings')); | ||||
| } | } | ||||
| migrate(settings); | |||||
| let form = document.forms.namedItem("custom-species-form"); | let form = document.forms.namedItem("custom-species-form"); | ||||
| for (let i=0; i<form.length; i++) { | for (let i=0; i<form.length; i++) { | ||||
| @@ -4807,9 +4814,15 @@ window.addEventListener('load', function(event) { | |||||
| } | } | ||||
| }()); | }()); | ||||
| document.querySelectorAll(".version").forEach(function(x) { | |||||
| x.innerText = "Version: " + version; | |||||
| }); | |||||
| construct_options(); | construct_options(); | ||||
| construct_panels(); | construct_panels(); | ||||
| document.querySelector("#save-version").innerText = save_version; | |||||
| document.querySelectorAll("input[type='number']").forEach(function(x) { | document.querySelectorAll("input[type='number']").forEach(function(x) { | ||||
| x.addEventListener("input", function() { updatePreview(x.id); }); | x.addEventListener("input", function() { updatePreview(x.id); }); | ||||
| }); | }); | ||||
| @@ -1,13 +1,8 @@ | |||||
| // bumps save versions | // bumps save versions | ||||
| migrations = [ | migrations = [ | ||||
| // 0 -> 1 | |||||
| // notes: only adds version number | |||||
| function(save) { | |||||
| save["version"] = 1; | |||||
| } | |||||
| // | |||||
| ] | |||||
| ]; | |||||
| function migrate(save, target=null) { | function migrate(save, target=null) { | ||||
| if (target == null) { | if (target == null) { | ||||
| @@ -17,7 +12,9 @@ function migrate(save, target=null) { | |||||
| let version = save.version; | let version = save.version; | ||||
| if (version == undefined) { | if (version == undefined) { | ||||
| version = 0; | |||||
| alert("This save is from before versioning was added. It can't be automatically updated, and it might lose some settings. Double check that everything's there! Any subsequent saves will work correctly."); | |||||
| save["version"] = migrations.length; | |||||
| return false; | |||||
| } | } | ||||
| if (version < target) { | if (version < target) { | ||||
| @@ -192,7 +192,8 @@ | |||||
| </div> | </div> | ||||
| <div id="log-area"> | <div id="log-area"> | ||||
| <div id="log"> | <div id="log"> | ||||
| <div>Welcome to Stroll 0.7.4</div> | |||||
| <div>Welcome to Stroll</div> | |||||
| <p class="version"></p> | |||||
| <div><b>This game features 18+ content</b></div> | <div><b>This game features 18+ content</b></div> | ||||
| <div> </div> | <div> </div> | ||||
| </div> | </div> | ||||
| @@ -206,7 +207,8 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="character-build" id="character-build-area"> | <div class="character-build" id="character-build-area"> | ||||
| <p>Welcome to Stroll 0.7.4</p> | |||||
| <p>Welcome to Stroll</p> | |||||
| <p class="version"></p> | |||||
| <p><b>This game features 18+ content</b></p> | <p><b>This game features 18+ content</b></p> | ||||
| <p><a href="https://chemicalcrux.org/stroll">Changelog</a> - <a href="https://t.me/joinchat/BSXHzUZmSqc-CXB1khkuYw">Telegram</a> - <a href="https://discord.gg/7pdcVhD">Discord</a></p> | <p><a href="https://chemicalcrux.org/stroll">Changelog</a> - <a href="https://t.me/joinchat/BSXHzUZmSqc-CXB1khkuYw">Telegram</a> - <a href="https://discord.gg/7pdcVhD">Discord</a></p> | ||||
| @@ -276,7 +278,7 @@ | |||||
| </ul> | </ul> | ||||
| <form id="custom-species-form" name="custom-species-form"> | <form id="custom-species-form" name="custom-species-form"> | ||||
| <ul class="flex-outer" id="character-flex-outer"> | <ul class="flex-outer" id="character-flex-outer"> | ||||
| <input class="save-version" id="save-version" name="version" type="number"></input> | |||||
| </ul> | </ul> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -690,3 +690,7 @@ body.dark .meterLabel { | |||||
| .growth-amount { | .growth-amount { | ||||
| display: block; | display: block; | ||||
| } | } | ||||
| .save-version { | |||||
| display: none; | |||||
| } | |||||