LocalServer: call endGame on replay when all turns have been executed

This commit is contained in:
evanpelle
2025-05-17 08:19:18 -07:00
parent 4cba9ae573
commit 1a0b3dbe88
+7
View File
@@ -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,