Fixing turn end bug.
This commit is contained in:
@@ -1445,20 +1445,23 @@
|
|||||||
`(,(car row) . ,(list->vector (cdr row))))
|
`(,(car row) . ,(list->vector (cdr row))))
|
||||||
*harvest-table*)))))
|
*harvest-table*)))))
|
||||||
((string=? type "turn-ended")
|
((string=? type "turn-ended")
|
||||||
(reconcile-display-cash player game)
|
(if (not (eq? (player-state player) 'turn-ended))
|
||||||
(safe-set! (player-harvesting player) #f)
|
(begin
|
||||||
(if (>= (player-cash player) 0)
|
(reconcile-display-cash player game)
|
||||||
(begin (advance-turn game player)
|
(safe-set! (player-harvesting player) #f)
|
||||||
(handle-exceptions
|
(if (>= (player-cash player) 0)
|
||||||
exn
|
(begin (advance-turn game player)
|
||||||
(begin (log-error exn)
|
(handle-exceptions
|
||||||
(log-msg "error saving app"))
|
exn
|
||||||
(save-game game))
|
(begin (log-error exn)
|
||||||
(if (eq? (game-state game) 'finished)
|
(log-msg "error saving app"))
|
||||||
(do-end-of-game game)
|
(save-game game))
|
||||||
(message-players! game player '() type: "update"))
|
(if (eq? (game-state game) 'finished)
|
||||||
(create-ws-response player "update" '()))
|
(do-end-of-game game)
|
||||||
(begin (create-ws-response player "update" '()))))
|
(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")
|
((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
|
||||||
|
|||||||
Reference in New Issue
Block a user