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 --- .../kotlin/org/luxons/sevenwonders/model/PlayerState.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sw-common-model') diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt index 1e483a56..db0a2eb6 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt @@ -4,14 +4,20 @@ import kotlinx.serialization.Serializable import org.luxons.sevenwonders.model.wonders.WonderBuildability @Serializable -data class PlayerTurnInfo( +data class PlayerTurnInfo( val playerIndex: Int, val table: TableState, - val action: TurnAction, + val action: A, ) { val currentAge: Int = table.currentAge val wonderBuildability: WonderBuildability = table.boards[playerIndex].wonder.buildability } // TODO move to server code -fun Collection.hideHandsAndWaitForReadiness() = map { it.copy(action = TurnAction.SayReady) } +fun Collection>.hideHandsAndWaitForReadiness() = map { + PlayerTurnInfo( + playerIndex = it.playerIndex, + table = it.table, + action = TurnAction.SayReady, + ) +} -- cgit