Fixing turn end bug.

master
Thomas Hintz 5 years ago
parent 9160fdc92a
commit ce0070ed7e

@ -1445,20 +1445,23 @@
`(,(car row) . ,(list->vector (cdr row))))
*harvest-table*)))))
((string=? type "turn-ended")
(reconcile-display-cash player game)
(safe-set! (player-harvesting player) #f)
(if (>= (player-cash player) 0)
(begin (advance-turn game player)
(handle-exceptions
exn
(begin (log-error exn)
(log-msg "error saving app"))
(save-game game))
(if (eq? (game-state game) 'finished)
(do-end-of-game game)
(message-players! game player '() type: "update"))
(create-ws-response player "update" '()))
(begin (create-ws-response player "update" '()))))
(if (not (eq? (player-state player) 'turn-ended))
(begin
(reconcile-display-cash player game)
(safe-set! (player-harvesting player) #f)
(if (>= (player-cash player) 0)
(begin (advance-turn game player)
(handle-exceptions
exn
(begin (log-error exn)
(log-msg "error saving app"))
(save-game game))
(if (eq? (game-state game) 'finished)
(do-end-of-game game)
(message-players! game player '() type: "update"))
(create-ws-response player "update" '()))
(begin (create-ws-response player "update" '()))))
(create-ws-response player "update" '())))
((string=? type "toggle-reveal-for-trading")
(let ((id (alist-ref 'id msg)))
(if (member id (player-revealed-cards player))
@ -1763,7 +1766,6 @@
1000)
-1)))))
(print "ending turn")
;; (thread-sleep! 0.5)
(set! (player-processing-turn player) #f)
(process-message player game "turn-ended" '()))
;; this could happen if we restart the game in the middle of a turn

Loading…
Cancel
Save