From: Mark Wooding Date: Sun, 24 Mar 2013 01:43:29 +0000 (+0000) Subject: atoms.lisp: Call `player-turn-begin' from the main loop. X-Git-Url: https://git.distorted.org.uk/~mdw/atoms/commitdiff_plain/03e309314d430f195f8f0d9cbe4d8d84c551ea46 atoms.lisp: Call `player-turn-begin' from the main loop. This will prevent huge recursion when multiple robots play each other. Also, make sure that the first player is told at the beginning of the game. --- diff --git a/atoms.lisp b/atoms.lisp index 60c6470..915c53e 100644 --- a/atoms.lisp +++ b/atoms.lisp @@ -312,7 +312,7 @@ (when (member (player-state player) '(:starting :playing)) (setf (game-player-index game) j (player-state player) :ready) - (player-turn-begin game player) + (glib:idle-add (lambda () (player-turn-begin game player) nil)) (changed game :start-turn :player player) (return)))))) @@ -386,7 +386,8 @@ (setf (player-score player) 0 (player-state player) (if (zerop i) :ready :starting)))) (setf (game-player-index game) 0) - (changed game :refresh)) + (changed game :refresh) + (glib:idle-add (lambda () (player-turn-begin game (aref players 0)) nil))) ;;;-------------------------------------------------------------------------- ;;; Snapshots and undo.