diff options
author | Joffrey Bion <joffrey.bion@gmail.com> | 2021-03-08 01:31:26 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@gmail.com> | 2021-03-08 01:31:59 +0100 |
commit | 3f8a672dcfefdd9304ba8b489865cb12153a75e3 (patch) | |
tree | 3b5e091d37b9f821e189ec26791db7a4eec177b4 /sw-engine/src/main/kotlin | |
parent | Make SayReady action an object (diff) | |
download | seven-wonders-3f8a672dcfefdd9304ba8b489865cb12153a75e3.tar.gz seven-wonders-3f8a672dcfefdd9304ba8b489865cb12153a75e3.tar.bz2 seven-wonders-3f8a672dcfefdd9304ba8b489865cb12153a75e3.zip |
Make turnInfo generic in its action type
Diffstat (limited to 'sw-engine/src/main/kotlin')
-rw-r--r-- | sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt | 10 |
1 files changed, 7 insertions, 3 deletions
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<Player> = boards.map { SimplePlayer(it.playerIndex, table) } private val discardedCards: MutableList<Card> = mutableListOf() private val preparedMoves: MutableMap<Int, Move> = mutableMapOf() - private var currentTurnInfo: List<PlayerTurnInfo> = emptyList() + private var currentTurnInfo: List<PlayerTurnInfo<*>> = 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<PlayerTurnInfo> = currentTurnInfo + fun getCurrentTurnInfo(): List<PlayerTurnInfo<*>> = currentTurnInfo /** * Prepares the given [move] for the player at the given [playerIndex]. |