Fixing turn end bug.

master
Thomas Hintz 5 years ago
parent 9160fdc92a
commit ce0070ed7e

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

Loading…
Cancel
Save