chiark / gitweb /
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 eac69bcee33b99290e92d60a4b00d9f5c5e8f576..af9a21cf4245f1956937528efc75e5df3c5597fd 100644 (file)
@@ -362,8 +362,8 @@ (defmethod play-cell ((game atom-game) player i j)
          (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)
@@ -1010,7 +1010,7 @@ (defun update-undo-redo-sensitivity (window)
 (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)