Skip to content

Commit

Permalink
game: return value from _read_saved_games() instead of storing directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jnikula committed Nov 17, 2024
1 parent b3328dd commit f03abc4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/Game.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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 {
Expand Down

0 comments on commit f03abc4

Please sign in to comment.