diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts index 628bce473..cec5e0bd8 100644 --- a/src/client/HostLobbyModal.ts +++ b/src/client/HostLobbyModal.ts @@ -628,12 +628,13 @@ export class HostLobbyModal extends LitElement { } private async startGame() { - this.selectedMap = this.useRandomMap - ? this.getRandomMap() - : this.selectedMap; + if (this.useRandomMap) { + this.selectedMap = this.getRandomMap(); + } + await this.putGameConfig(); consolex.log( - `Starting single player game with map: ${GameMapType[this.selectedMap]} ${this.useRandomMap ? " (Randomly selected)" : ""}`, + `Starting private game with map: ${GameMapType[this.selectedMap]} ${this.useRandomMap ? " (Randomly selected)" : ""}`, ); this.close(); const response = await fetch(`/start_private_lobby/${this.lobbyId}`, { diff --git a/src/client/SinglePlayerModal.ts b/src/client/SinglePlayerModal.ts index 5aa12db9f..a119e2a9c 100644 --- a/src/client/SinglePlayerModal.ts +++ b/src/client/SinglePlayerModal.ts @@ -463,10 +463,12 @@ export class SinglePlayerModal extends LitElement { private startGame() { // If random map is selected, choose a random map now - const mapToUse = this.useRandomMap ? this.getRandomMap() : this.selectedMap; + if (this.useRandomMap) { + this.selectedMap = this.getRandomMap(); + } consolex.log( - `Starting single player game with map: ${GameMapType[mapToUse]}${this.useRandomMap ? " (Randomly selected)" : ""}`, + `Starting single player game with map: ${GameMapType[this.selectedMap]}${this.useRandomMap ? " (Randomly selected)" : ""}`, ); this.dispatchEvent( @@ -476,7 +478,7 @@ export class SinglePlayerModal extends LitElement { lobby: { id: generateID(), }, - map: mapToUse, + map: this.selectedMap, difficulty: this.selectedDifficulty, disableNPCs: this.disableNPCs, bots: this.bots,