diff --git a/package.json b/package.json index f900abd..2147f08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minesweeper", - "version": "0.81.9", + "version": "0.81.10", "description": "Just Minesweeper!", "author": "Felix W. Dekker", "browser": "dist/bundle.js", diff --git a/src/main/js/Field.ts b/src/main/js/Field.ts index 0b5aaa0..185904d 100644 --- a/src/main/js/Field.ts +++ b/src/main/js/Field.ts @@ -405,8 +405,11 @@ export class Field { * @param amount the maximum amount of actions to redo, or all future actions if `undefined` */ redo(amount: number | undefined = undefined): void { + const wasLost = this.hasLost; + const redone = this.history.redo(amount); if (!this.isAutoSolving && redone > 0) this.statistics.actionsRedone++; + if (!this.isAutoSolving && !wasLost && this.hasLost) this.statistics.lossesRedone++; } /** diff --git a/src/main/js/Statistics.ts b/src/main/js/Statistics.ts index 17ddb85..03d1df3 100644 --- a/src/main/js/Statistics.ts +++ b/src/main/js/Statistics.ts @@ -9,6 +9,7 @@ export interface Statistics { actionsUndone: number; actionsRedone: number; lossesUndone: number; + lossesRedone: number; timeSpent: number; gamesStarted: number; @@ -68,6 +69,14 @@ export class LocalStatistics implements Statistics { this.storage.setNumber("lossesUndone", value); } + get lossesRedone(): number { + return this.storage.getNumber("lossesRedone", 0); + } + + set lossesRedone(value: number) { + this.storage.setNumber("lossesRedone", value); + } + get timeSpent(): number { return this.storage.getNumber("timeSpent", 0); } @@ -184,6 +193,7 @@ export class LocalStatistics implements Statistics {