diff options
Diffstat (limited to 'sw-server/src/main')
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/api/Converters.kt | 2 | ||||
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/lobby/Lobby.kt | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/api/Converters.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/api/Converters.kt index 6f0fc180..390dc839 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/api/Converters.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/api/Converters.kt @@ -7,7 +7,7 @@ import org.luxons.sevenwonders.server.lobby.Player fun Lobby.toDTO(currentUser: String): LobbyDTO { val players = getPlayers().map { it.toDTO(currentUser) } - return LobbyDTO(id, name, owner.username, players, state) + return LobbyDTO(id, name, owner.username, players, state, canBeStarted()) } fun Player.toDTO(currentUser: String) = diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/lobby/Lobby.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/lobby/Lobby.kt index 7158a417..599d889f 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/lobby/Lobby.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/lobby/Lobby.kt @@ -57,6 +57,8 @@ class Lobby( return game } + fun canBeStarted(): Boolean = hasEnoughPlayers() + private fun hasEnoughPlayers(): Boolean = players.size >= gameDefinition.minPlayers @Synchronized |