X-Git-Url: https://git.distorted.org.uk/~mdw/atoms/blobdiff_plain/3c0a8e1fda3c627e9d8040924129bbe17a0e85ca..f636a83313622d3e6e3b4dfd9013d274f6ae376a:/atoms.lisp diff --git a/atoms.lisp b/atoms.lisp index eac69bc..6aeb8de 100644 --- a/atoms.lisp +++ b/atoms.lisp @@ -26,8 +26,7 @@ #+cmu #:ext #+sbcl #:sb-ext #+clisp #:ext) - #+clisp (:shadow #:map-dependents #:add-dependent #:remove-dependent) - (:export #:start-atom-game)) + #+clisp (:shadow #:map-dependents #:add-dependent #:remove-dependent)) (cl:in-package #:atoms) (eval-when (:compile-toplevel :load-toplevel :execute) @@ -362,8 +361,8 @@ (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) @@ -1000,17 +999,16 @@ (defun update-undo-redo-sensitivity (window) (with-slots (actions game) window - (setf (gtk:action-sensitive-p - (gtk:action-group-get-action actions "undo")) - (undo-list game) - (gtk:action-sensitive-p - (gtk:action-group-get-action actions "redo")) - (redo-list game)))) + (flet ((set-sensitive (act-name sensitivep) + (let ((act (gtk:action-group-get-action actions act-name))) + (setf (gtk:action-sensitive-p act) sensitivep)))) + (set-sensitive "undo" (undo-list game)) + (set-sensitive "redo" (redo-list game))))) (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) @@ -1151,6 +1149,7 @@ (defvar *window* nil) +(export 'start-atom-game) (defun start-atom-game (&rest initargs) (when *window* (gtk:widget-destroy *window*) @@ -1158,6 +1157,8 @@ (setf *window* (apply #'make-instance 'atom-game-window initargs)) (gtk:widget-show-all *window*)) -(start-atom-game :width 7 :players (list "Mark" "Vicky")) +#+debug +(start-atom-game :width 7 + :players '("Alice" "Bob")) ;;;----- That's all, folks --------------------------------------------------