From 602e4abece389383e74d064123966c19d21baa13 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sat, 11 Oct 2025 14:21:37 -0700 Subject: [PATCH] TypeScript fixes --- server/routes/games.ts | 2 +- server/routes/games/gameFactory.ts | 9 +++++++++ server/routes/games/playerFactory.ts | 10 +++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/server/routes/games.ts b/server/routes/games.ts index 6449b9b..905566a 100755 --- a/server/routes/games.ts +++ b/server/routes/games.ts @@ -2,7 +2,7 @@ import express from 'express'; import crypto from 'crypto'; import { layout, staticData } from '../util/layout'; import basePath from '../basepath'; -import { types, debug, all, info, INCOMING_GET_BATCH_MS } from './games/constants'; +import { debug, all, info, INCOMING_GET_BATCH_MS } from './games/constants'; import { getValidRoads, getValidCorners, isRuleEnabled } from '../util/validLocations'; import { diff --git a/server/routes/games/gameFactory.ts b/server/routes/games/gameFactory.ts index 89e1c04..70e2602 100644 --- a/server/routes/games/gameFactory.ts +++ b/server/routes/games/gameFactory.ts @@ -264,6 +264,15 @@ export const createGame = async (id: string | null = null) => { actions: [], limits: {}, roll: 0, + volcano: null, + free: false, + freeRoads: 0, + select: {}, + active: null, + robberInAction: false, + placedRobber: false, + developmentPurchased: false, + offer: null, }, rules: { "victory-points": { diff --git a/server/routes/games/playerFactory.ts b/server/routes/games/playerFactory.ts index ce8e41d..66b632a 100644 --- a/server/routes/games/playerFactory.ts +++ b/server/routes/games/playerFactory.ts @@ -1,7 +1,10 @@ import { MAX_ROADS, MAX_CITIES, MAX_SETTLEMENTS } from "./constants"; -import type { Player, PlayerColor } from "./types"; +import { PLAYER_COLORS, type Player, type PlayerColor } from "./types"; export const newPlayer = (color: PlayerColor): Player => { + const tmp = {} as any; + PLAYER_COLORS.forEach((c) => { tmp[c] = false; }); + const offerRejected = { ...tmp }; return { roads: MAX_ROADS, cities: MAX_CITIES, @@ -16,6 +19,8 @@ export const newPlayer = (color: PlayerColor): Player => { sheep: 0, wood: 0, brick: 0, + desert: 0, /* Not used -- for Typescript compliance */ + bank: 0, /* Not used -- for Typescript compliance */ army: 0, development: [], color: color, @@ -33,6 +38,9 @@ export const newPlayer = (color: PlayerColor): Player => { turnNotice: "", longestRoad: 0, banks: [], + gives: [], + gets: [], + offerRejected, }; };