From 2837461addfa3568c37f5696cfa7d862086cd1e4 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 23 Feb 2025 22:23:27 -0800 Subject: [PATCH] create StateManager from file --- src/statemanager.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/statemanager.ts b/src/statemanager.ts index 50489ec..7b09f44 100644 --- a/src/statemanager.ts +++ b/src/statemanager.ts @@ -10,6 +10,7 @@ import { openingScene } from "./openingscene.ts"; import { generateName } from "./namegen.ts"; import { photogenicThralls } from "./thralls.ts"; import { choose } from "./utils.ts"; +import { SaveFileV1 } from "./saveformat.ts"; const N_TURNS: number = 9; @@ -17,9 +18,9 @@ export class StateManager { #turn: number; #revision: number; - constructor() { - this.#turn = 1; - this.#revision = 1; + constructor(file?:SaveFileV1) { + this.#turn = file?.turn ?? 1; + this.#revision = file?.revision ?? 1; } getTurn(): number {