atoms.lisp: Call `player-turn-begin' from the main loop.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Mar 2013 01:43:29 +0000 (01:43 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 24 Mar 2013 01:43:29 +0000 (01:43 +0000)
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.

atoms.lisp

index 60c6470..915c53e 100644 (file)
        (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))))))
 
       (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.