1
0

TypeScript fixes

This commit is contained in:
James Ketr 2025-10-11 14:21:37 -07:00
parent da90e012fc
commit 602e4abece
3 changed files with 19 additions and 2 deletions

View File

@ -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 {

View File

@ -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": {

View File

@ -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,
};
};