summaryrefslogtreecommitdiff
path: root/sw-server/src/main/kotlin/org/luxons
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-10 02:36:32 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-10 02:36:32 +0100
commit629838b1870442b91ace0f41895021302b08d511 (patch)
treed143f5e63973f44f0841dba9c165295ead2b833a /sw-server/src/main/kotlin/org/luxons
parentClean games when all humans have left (diff)
downloadseven-wonders-629838b1870442b91ace0f41895021302b08d511.tar.gz
seven-wonders-629838b1870442b91ace0f41895021302b08d511.tar.bz2
seven-wonders-629838b1870442b91ace0f41895021302b08d511.zip
Fix lobby state updates in game browser
Resolves: https://github.com/joffrey-bion/seven-wonders/issues/97
Diffstat (limited to 'sw-server/src/main/kotlin/org/luxons')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt2
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt1
2 files changed, 3 insertions, 0 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 60307962..bd6e300e 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.api.actions.PrepareMoveAction
import org.luxons.sevenwonders.model.api.wrap
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.LobbyRepository
import org.luxons.sevenwonders.server.repositories.PlayerRepository
@@ -100,6 +101,7 @@ class GameController(
if (game.endOfGameReached()) {
logger.info("Game {}: end of game, displaying score board", game.id)
player.lobby.setEndOfGame()
+ template.convertAndSend("/topic/games", GameListEvent.CreateOrUpdate(lobby.toDTO()).wrap())
}
} else {
template.convertAndSendToUser(player.username, "/queue/game/preparedMove", action.move)
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 f2124009..5c2d4dd6 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
@@ -191,6 +191,7 @@ class LobbyController(
val player = lobby.getPlayers()[it.playerIndex]
template.convertAndSendToUser(player.username, "/queue/lobby/started", it)
}
+ template.convertAndSend("/topic/games", GameListEvent.CreateOrUpdate(lobby.toDTO()).wrap())
}
private fun Lobby.initializePlayersReadyState() {
bgstack15