From f03abc42d93b6abf7e713090364cd30f789fa666 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 17 Nov 2024 14:29:57 +0200 Subject: [PATCH] game: return value from _read_saved_games() instead of storing directly --- src/lib/Game.svelte.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/Game.svelte.ts b/src/lib/Game.svelte.ts index 14728d5..55e447f 100644 --- a/src/lib/Game.svelte.ts +++ b/src/lib/Game.svelte.ts @@ -20,10 +20,10 @@ export class Game { } constructor() { - this._read_saved_games(); + this.saved_games = this._read_saved_games(); } - private _read_saved_games(): void { + private _read_saved_games(): SaveGameId[] { let saved: SaveGameId[] = []; for (let slot of [0,1,2]) { @@ -44,7 +44,7 @@ export class Game { // save new game in the oldest slot this._save_game_slot = saved[saved.length - 1].slot; - this.saved_games = saved; + return saved; } save_game_name(): string {