Browse Source

Set up for v1.0 save version

tags/v1.0.0
Fen Dweller 6 years ago
parent
commit
925164b7c0
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      migrations.js

+ 9
- 1
migrations.js View File

@@ -1,7 +1,9 @@
// bumps save versions // bumps save versions


migrations = [ migrations = [

(save) => {
save.version = 1;
}
]; ];


function migrate(save, target=null) { function migrate(save, target=null) {
@@ -17,6 +19,12 @@ function migrate(save, target=null) {
return false; return false;
} }


if (version == 0 ) {
alert("This save is from before v1.0. It can't be automatically migrated, so it may lose some settings. Double check the resulting character. Subsequent saves will function correctly.");
save["version"] = migrations.length;
return false;
}

if (version < target) { if (version < target) {
for (let x = version; x < target; x++) { for (let x = version; x < target; x++) {
migrations[x](save); migrations[x](save);


Loading…
Cancel
Save