summaryrefslogtreecommitdiff
path: root/sw-server/src/main/kotlin/org/luxons
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-30 11:30:32 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-30 11:35:10 +0200
commit0ca4028cdb58cc7649da04c0c2b16479ecd83d79 (patch)
treef027e587b2c4d8d30acdb4e6205d0319fe5df9b4 /sw-server/src/main/kotlin/org/luxons
parentRename GameState -> TableState (diff)
downloadseven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.tar.gz
seven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.tar.bz2
seven-wonders-0ca4028cdb58cc7649da04c0c2b16479ecd83d79.zip
Send turn info without hands when entering game
Diffstat (limited to 'sw-server/src/main/kotlin/org/luxons')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt4
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt6
2 files changed, 6 insertions, 4 deletions
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt
index 803cca78..733259b9 100644
--- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt
+++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt
@@ -6,6 +6,7 @@ import org.luxons.sevenwonders.model.Action
import org.luxons.sevenwonders.model.PlayerTurnInfo
import org.luxons.sevenwonders.model.api.actions.PrepareMoveAction
import org.luxons.sevenwonders.model.cards.PreparedCard
+import org.luxons.sevenwonders.model.hideHandsAndWaitForReadiness
import org.luxons.sevenwonders.server.api.toDTO
import org.luxons.sevenwonders.server.lobby.Player
import org.luxons.sevenwonders.server.repositories.PlayerRepository
@@ -92,9 +93,6 @@ class GameController @Autowired constructor(
}
}
- private fun Collection<PlayerTurnInfo>.hideHandsAndWaitForReadiness() =
- map { it.copy(action = Action.SAY_READY, hand = null) }
-
companion object {
private val logger = LoggerFactory.getLogger(GameController::class.java)
}
diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt
index 04fb2228..ee1c6271 100644
--- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt
+++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt
@@ -3,6 +3,7 @@ package org.luxons.sevenwonders.server.controllers
import org.hildan.livedoc.core.annotations.Api
import org.luxons.sevenwonders.model.api.actions.ReorderPlayersAction
import org.luxons.sevenwonders.model.api.actions.UpdateSettingsAction
+import org.luxons.sevenwonders.model.hideHandsAndWaitForReadiness
import org.luxons.sevenwonders.server.api.toDTO
import org.luxons.sevenwonders.server.lobby.Lobby
import org.luxons.sevenwonders.server.lobby.Player
@@ -101,7 +102,10 @@ class LobbyController @Autowired constructor(
val game = lobby.startGame()
logger.info("Game {} successfully started", game.id)
- template.convertAndSend("/topic/lobby/" + lobby.id + "/started", Unit)
+ game.getCurrentTurnInfo().hideHandsAndWaitForReadiness().forEach {
+ val player = lobby.getPlayers()[it.playerIndex]
+ template.convertAndSendToUser(player.username, "/queue/lobby/" + lobby.id + "/started", it)
+ }
}
companion object {
bgstack15