summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-09 19:10:29 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-09 19:10:29 +0100
commit5164fc1ebca5fbb656e7ae4108a0d52314a76b10 (patch)
tree753c96c30aa68f628cade070a78a826b854f0952 /sw-common-model
parentAdd deployment notifications for discord (diff)
downloadseven-wonders-5164fc1ebca5fbb656e7ae4108a0d52314a76b10.tar.gz
seven-wonders-5164fc1ebca5fbb656e7ae4108a0d52314a76b10.tar.bz2
seven-wonders-5164fc1ebca5fbb656e7ae4108a0d52314a76b10.zip
Improve "join" tooltip for FINISHED games
Diffstat (limited to 'sw-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
index 7c9ed800..59515057 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/Lobby.kt
@@ -54,7 +54,10 @@ data class LobbyDTO(
fun findWonder(name: String): PreGameWonder = wondersByName[name] ?: error("Unknown wonder '$name'")
fun joinability(userDisplayName: String): Actionability = when {
- state != State.LOBBY -> Actionability(false, "Cannot join: the game has already started")
+ state == State.PLAYING -> Actionability(false, "Cannot join: the game has already started")
+ state == State.FINISHED -> Actionability(false, "Cannot join: the game is over")
+ // should only ever happen if a new state is added
+ state != State.LOBBY -> Actionability(false, "Cannot join the game at this time")
maxPlayersReached -> Actionability(false, "Cannot join: the game is full")
playerNameAlreadyUsed(userDisplayName) -> Actionability(
canDo = false,
bgstack15