Fixing auto-skip in harvest and adding restart-game.

This commit is contained in:
2020-04-06 16:59:07 -07:00
parent f485f811ba
commit 38c2920b85
2 changed files with 47 additions and 32 deletions

View File

@@ -418,6 +418,17 @@
;; (print "</body></html>")))
)
(define (restart-game game first-player)
(safe-set! (game-called-audit game) #f)
(safe-set! (game-state game) 'playing)
(for-each (lambda (p)
(safe-set! (player-finished p) #f)
(safe-set! (player-state p) 'turn-ended))
(game-players game))
(safe-set! (player-state first-player) 'pre-turn)
(safe-set! (game-current-player game) first-player)
(message-players! game #f '() type: "update"))
(define-method (player->list (p <player>))
`((player . ((assets . ,(player-assets p))
(ridges . ,(player-ridges p))
@@ -1190,14 +1201,15 @@
(player (add-player-to-game game
color
(alist-ref 'playerName msg)))
(ai-player (add-ai-to-game game 'red "AI Player 1")))
;; (ai-player (add-ai-to-game game 'red "AI Player 1"))
)
(push! game (app-games *app*))
(session-set! (sid) 'player player)
(session-set! (sid) 'game game)
(*game* game)
(set-startup-otbs game player 2)
(set-startup-otbs game ai-player 2)
(thread-start! (make-ai-push-receiver game ai-player))
;; (set-startup-otbs game ai-player 2)
;; (thread-start! (make-ai-push-receiver game ai-player))
(create-start-response "new-game-started")))
((string=? type "join-game")
(let* ((name (alist-ref 'gameName msg))
@@ -2099,9 +2111,6 @@
;; info actions should look better
;; you can get $50 from operating expense
;; auto-skip loop
;; harvester / tractor don't say total price
;; mark spaces
;; error:
@@ -2148,6 +2157,4 @@
;; Error: (assv) bad argument type: #<coops instance of `<game>'>
;; auto-skip loop wtih harvest
;; when getting trade the name is wrong