From 3f8a672dcfefdd9304ba8b489865cb12153a75e3 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Mon, 8 Mar 2021 01:31:26 +0100 Subject: Make turnInfo generic in its action type --- .../src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sw-engine/src/main/kotlin/org') diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt index 6c44c7b3..5281c753 100644 --- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt +++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt @@ -26,7 +26,7 @@ class Game internal constructor( private val players: List = boards.map { SimplePlayer(it.playerIndex, table) } private val discardedCards: MutableList = mutableListOf() private val preparedMoves: MutableMap = mutableMapOf() - private var currentTurnInfo: List = emptyList() + private var currentTurnInfo: List> = emptyList() private var hands: Hands = Hands(emptyList()) private var militaryConflictsResolved = false @@ -88,7 +88,11 @@ class Game internal constructor( } val scoreBoard = computeScore() currentTurnInfo = currentTurnInfo.map { - it.copy(action = TurnAction.WatchScore(message = ActionMessages.WATCH_SCORE, scoreBoard = scoreBoard)) + PlayerTurnInfo( + playerIndex = it.playerIndex, + table = it.table, + action = TurnAction.WatchScore(message = ActionMessages.WATCH_SCORE, scoreBoard = scoreBoard), + ) } } @@ -105,7 +109,7 @@ class Game internal constructor( /** * Returns information for each player about the current turn. */ - fun getCurrentTurnInfo(): List = currentTurnInfo + fun getCurrentTurnInfo(): List> = currentTurnInfo /** * Prepares the given [move] for the player at the given [playerIndex]. -- cgit