From 5956ac6c95dfcb8d7e1186bde1f0887989bdf3de Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Mon, 19 Apr 2021 09:21:25 +0200 Subject: [PATCH] Adjust Version-Check to look on length of buildings; --- js/app.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/js/app.js b/js/app.js index 43ca49b..5dcb4a3 100644 --- a/js/app.js +++ b/js/app.js @@ -1,7 +1,6 @@ let game = new Vue({ el: '#root', data: { - version: 0.3, money: 0, loaded: false, resources: { @@ -133,7 +132,7 @@ let game = new Vue({ loadedIntervals: [] }, created() { - this.versionCheck(); + this.checkBuildings(); this.money = this.getSavedMoney(); this.saveMoney(); @@ -144,15 +143,12 @@ let game = new Vue({ this.loaded = true; }, methods: { - versionCheck() { - let lastVersion = localStorage.getItem('lastVersion'); + checkBuildings() { + let savedBuildings = JSON.parse(localStorage.getItem('buildings')); - if ((lastVersion && lastVersion > this.version)) { + if (savedBuildings.length !== this.buildings.length) { localStorage.setItem('buildings', this.buildings.stringify()); - localStorage.setItem('lastVersion', this.version); alert('Buildings have been resetted due to an important update.') - } else { - localStorage.setItem('lastVersion', this.version); } },