From 1a0b3dbe88c29d203f603ab2f14557aa9dc2381c Mon Sep 17 00:00:00 2001 From: evanpelle Date: Sat, 17 May 2025 08:19:18 -0700 Subject: [PATCH] LocalServer: call endGame on replay when all turns have been executed --- src/client/LocalServer.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client/LocalServer.ts b/src/client/LocalServer.ts index 16edbdfb1..5c4f826e4 100644 --- a/src/client/LocalServer.ts +++ b/src/client/LocalServer.ts @@ -150,6 +150,10 @@ export class LocalServer { return; } if (this.replayTurns.length > 0) { + if (this.turns.length >= this.replayTurns.length) { + this.endGame(); + return; + } this.intents = this.replayTurns[this.turns.length].intents; } const pastTurn: Turn = { @@ -167,6 +171,9 @@ export class LocalServer { public endGame(saveFullGame: boolean = false) { consolex.log("local server ending game"); clearInterval(this.turnCheckInterval); + if (this.isReplay) { + return; + } const players: PlayerRecord[] = [ { ip: null,