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-common-model/src/commonMain/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-common-model/src/commonMain/kotlin')
-rw-r--r-- | sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt | 12 |
1 files changed, 9 insertions, 3 deletions
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<out A : TurnAction>( 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<PlayerTurnInfo>.hideHandsAndWaitForReadiness() = map { it.copy(action = TurnAction.SayReady) } +fun Collection<PlayerTurnInfo<*>>.hideHandsAndWaitForReadiness() = map { + PlayerTurnInfo( + playerIndex = it.playerIndex, + table = it.table, + action = TurnAction.SayReady, + ) +} |