atoms.lisp: Fix undo/redo action sensitivity.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 22 Mar 2013 22:52:52 +0000 (22:52 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 22 Mar 2013 22:52:52 +0000 (22:52 +0000)
Undo should be available after the first turn, but wasn't.  The reason
is twofold:

  * `update-undo-redo-sensitivity' was hooked onto :processing-move
    rather than :start-turn, which was just a mistake, though it seemed
    not to be because the order of the notifications was wrong; and

  * `perform-explosions', which is where :start-turn is issued, was
    being called before the undo record was laid down, whereas it should
    always have been afterwards.

atoms.lisp

index eac69bc..af9a21c 100644 (file)
          (unless (cell-played cell player-index)
            (return-from escape))
          (setf (player-state player) :playing)
          (unless (cell-played cell player-index)
            (return-from escape))
          (setf (player-state player) :playing)
-         (changed game :processing-move)
-         (perform-explosions game (list cell)))))))
+         (changed game :processing-move))
+       (perform-explosions game (list cell))))))
 
 (defmethod restart-game ((game atom-game) &key grid players)
   (game-cancel-timeout game)
 
 (defmethod restart-game ((game atom-game) &key grid players)
   (game-cancel-timeout game)
 (defmethod notify progn
     ((window atom-game-window) (game atom-game) aspect &key)
   (case aspect
 (defmethod notify progn
     ((window atom-game-window) (game atom-game) aspect &key)
   (case aspect
-    ((:undo :redo :refresh :processing-move)
+    ((:undo :redo :refresh :start-turn)
      (update-undo-redo-sensitivity window))))
 
 (defun action-undo (window)
      (update-undo-redo-sensitivity window))))
 
 (defun action-undo (window)