From 4e75c416e268da88ca2ca74530575241984c9ba0 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Mon, 8 Mar 2021 00:12:06 +0100 Subject: Make SayReady action an object --- .../kotlin/org/luxons/sevenwonders/model/PlayerState.kt | 2 +- .../kotlin/org/luxons/sevenwonders/model/TurnActions.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sw-common-model/src') 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 90d23aa9..1e483a56 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 @@ -14,4 +14,4 @@ data class PlayerTurnInfo( } // TODO move to server code -fun Collection.hideHandsAndWaitForReadiness() = map { it.copy(action = TurnAction.SayReady()) } +fun Collection.hideHandsAndWaitForReadiness() = map { it.copy(action = TurnAction.SayReady) } diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/TurnActions.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/TurnActions.kt index bd94944b..af01dccd 100644 --- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/TurnActions.kt +++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/TurnActions.kt @@ -23,9 +23,11 @@ sealed class TurnAction { abstract val message: String @Serializable - data class SayReady( - override val message: String = ActionMessages.SAY_READY, - ) : TurnAction() + object SayReady : TurnAction() { + override val message: String = ActionMessages.SAY_READY + + override fun toString(): String = "Say Ready" + } @Serializable data class PlayFromHand( -- cgit