summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/PlayerState.kt12
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,
+ )
+}
bgstack15