summaryrefslogtreecommitdiff
path: root/sw-server/src
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-26 10:20:02 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-26 10:20:02 +0200
commit27e7e39608987f6d354b0c9c52eee10e1fa31ba2 (patch)
treeafd1fcdf745cbd51d1f324230e95be03e68b7041 /sw-server/src
parentMake bots explore more by choosing random cards instead of first (diff)
downloadseven-wonders-27e7e39608987f6d354b0c9c52eee10e1fa31ba2.tar.gz
seven-wonders-27e7e39608987f6d354b0c9c52eee10e1fa31ba2.tar.bz2
seven-wonders-27e7e39608987f6d354b0c9c52eee10e1fa31ba2.zip
Fix race condition bewteen next turn and prepared move
Resolves: https://github.com/joffrey-bion/seven-wonders/issues/24
Diffstat (limited to 'sw-server/src')
-rw-r--r--sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt6
1 files changed, 3 insertions, 3 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 dc5dffdb..e86e7b54 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
@@ -62,8 +62,7 @@ class GameController(
* the connected user's information
*/
@MessageMapping("/game/prepareMove")
- @SendToUser("/queue/game/preparedMove")
- fun prepareMove(action: PrepareMoveAction, principal: Principal): PlayerMove {
+ fun prepareMove(action: PrepareMoveAction, principal: Principal) {
val player = principal.player
val game = player.game
val preparedCardBack = game.prepareMove(player.index, action.move)
@@ -78,8 +77,9 @@ class GameController(
if (game.endOfGameReached()) {
player.lobby.setEndOfGame()
}
+ } else {
+ template.convertAndSendToUser(player.username, "/queue/game/preparedMove", action.move)
}
- return action.move
}
@MessageMapping("/game/unprepareMove")
bgstack15