diff --git a/src/core/execution/SpawnExecution.ts b/src/core/execution/SpawnExecution.ts index 695096c9f..74e1df782 100644 --- a/src/core/execution/SpawnExecution.ts +++ b/src/core/execution/SpawnExecution.ts @@ -29,10 +29,7 @@ export class SpawnExecution implements Execution { if (this.mg.hasPlayer(this.playerInfo.id)) { player = this.mg.player(this.playerInfo.id); } else { - player = this.mg.addPlayer( - this.playerInfo, - this.mg.config().startManpower(this.playerInfo), - ); + player = this.mg.addPlayer(this.playerInfo); } player.tiles().forEach((t) => player.relinquish(t)); diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index f5e51c15c..5dd3087dc 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -433,7 +433,7 @@ export interface Game extends GameMap { playerByClientID(id: ClientID): Player | null; playerBySmallID(id: number): Player | TerraNullius; hasPlayer(id: PlayerID): boolean; - addPlayer(playerInfo: PlayerInfo, manpower: number): Player; + addPlayer(playerInfo: PlayerInfo): Player; terraNullius(): TerraNullius; owner(ref: TileRef): Player | TerraNullius; diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index dc4807ca6..bd13ceeac 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -107,9 +107,7 @@ export class GameImpl implements Game { private addHumans() { if (this.config().gameConfig().gameMode != GameMode.Team) { - this._humans.forEach((p) => - this.addPlayer(p, this.config().startManpower(p)), - ); + this._humans.forEach((p) => this.addPlayer(p)); return; } const playerToTeam = assignTeams(this._humans); @@ -118,7 +116,7 @@ export class GameImpl implements Game { console.warn(`Player ${playerInfo.name} was kicked from team`); continue; } - this.addPlayer(playerInfo, 0, team); + this.addPlayer(playerInfo, team); } } @@ -348,16 +346,12 @@ export class GameImpl implements Game { return this.player(id); } - addPlayer( - playerInfo: PlayerInfo, - manpower: number, - team: Team = null, - ): Player { + addPlayer(playerInfo: PlayerInfo, team: Team = null): Player { const player = new PlayerImpl( this, this.nextPlayerID, playerInfo, - manpower, + this.config().startManpower(playerInfo), team ?? this.maybeAssignTeam(playerInfo), ); this._playersBySmallID.push(player); diff --git a/tests/Attack.test.ts b/tests/Attack.test.ts index 1fa3d1b41..f9c46bcc3 100644 --- a/tests/Attack.test.ts +++ b/tests/Attack.test.ts @@ -39,7 +39,7 @@ describe("Attack", () => { null, "attacker_id", ); - game.addPlayer(attackerInfo, 1000); + game.addPlayer(attackerInfo); const defenderInfo = new PlayerInfo( "us", "defender dude", @@ -47,7 +47,7 @@ describe("Attack", () => { null, "defender_id", ); - game.addPlayer(defenderInfo, 1000); + game.addPlayer(defenderInfo); defenderSpawn = game.ref(0, 15); attackerSpawn = game.ref(0, 10); diff --git a/tests/MissileSilo.test.ts b/tests/MissileSilo.test.ts index 1c7dd44b3..e8e926b3d 100644 --- a/tests/MissileSilo.test.ts +++ b/tests/MissileSilo.test.ts @@ -38,7 +38,7 @@ describe("MissileSilo", () => { null, "attacker_id", ); - game.addPlayer(attacker_info, 1000); + game.addPlayer(attacker_info); game.addExecution( new SpawnExecution(game.player(attacker_info.id).info(), game.ref(1, 1)), diff --git a/tests/SAM.test.ts b/tests/SAM.test.ts index 83a59ef4f..4f63f9274 100644 --- a/tests/SAM.test.ts +++ b/tests/SAM.test.ts @@ -50,8 +50,8 @@ describe("SAM", () => { null, "attacker_id", ); - game.addPlayer(defender_info, 1000); - game.addPlayer(attacker_info, 1000); + game.addPlayer(defender_info); + game.addPlayer(attacker_info); game.addExecution( new SpawnExecution(game.player(defender_info.id).info(), game.ref(1, 1)), diff --git a/tests/TerritoryCapture.test.ts b/tests/TerritoryCapture.test.ts index a32aeb6b7..aee96aec6 100644 --- a/tests/TerritoryCapture.test.ts +++ b/tests/TerritoryCapture.test.ts @@ -7,7 +7,6 @@ describe("Territory management", () => { const game = await setup("Plains"); game.addPlayer( new PlayerInfo("us", "test_player", PlayerType.Human, null, "test_id"), - 1000, ); const spawnTile = game.map().ref(50, 50); game.addExecution( diff --git a/tests/Warship.test.ts b/tests/Warship.test.ts index e7adcd47e..c1ca61ecf 100644 --- a/tests/Warship.test.ts +++ b/tests/Warship.test.ts @@ -27,7 +27,7 @@ describe("Warship", () => { null, "player_1_id", ); - game.addPlayer(player_1_info, 1000); + game.addPlayer(player_1_info); const player_2_info = new PlayerInfo( "us", "boat dude", @@ -35,7 +35,7 @@ describe("Warship", () => { null, "player_2_id", ); - game.addPlayer(player_2_info, 1000); + game.addPlayer(player_2_info); game.addExecution( new SpawnExecution(