summaryrefslogtreecommitdiff
path: root/sw-server/src/main
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-10 19:42:09 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-10 19:42:09 +0100
commitcad1079db46c30055698552fb8dd422eb9afddea (patch)
tree3a9af71092b218251985f611c9426608efcfb8df /sw-server/src/main
parentUpdate JVM target to 15 (diff)
downloadseven-wonders-cad1079db46c30055698552fb8dd422eb9afddea.tar.gz
seven-wonders-cad1079db46c30055698552fb8dd422eb9afddea.tar.bz2
seven-wonders-cad1079db46c30055698552fb8dd422eb9afddea.zip
Properly clean redux state when leaving a game
Diffstat (limited to 'sw-server/src/main')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt2
1 files changed, 2 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 bd6e300e..47e01876 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
@@ -153,6 +153,8 @@ class GameController(
synchronized(game) {
lobby.removePlayer(player.username)
logger.info("Game {}: player {} left the game", game.id, player)
+ template.convertAndSendToUser(player.username, "/queue/lobby/left", lobby.id)
+
// This could cause problems if the humans are faster than bots to leave a finished game,
// but this case should be quite rare, so it does not matter much
if (lobby.getPlayers().none { it.isHuman }) {
bgstack15