]> code.delx.au - gnu-emacs-elpa/commitdiff
* chess-display.el (chess-display-move): Fix repainting when playing
authorMario Lang <mlang@delysid.org>
Sun, 15 Jun 2014 23:08:48 +0000 (01:08 +0200)
committerMario Lang <mlang@delysid.org>
Sun, 15 Jun 2014 23:08:48 +0000 (01:08 +0200)
against the internal engine (AI) which runs off the `post-move' game
event by adding a `redisplay' call just before the `post-move' emision.
(chess-display-select-piece): Use `chess-display-draw-square'.
(chess-display-draw-square): Make PIECE argument optional.

ChangeLog
chess-display.el

index 436fe5b6fe93a891a633b3f9b08000bad9106db7..621a5c464537874aa015b927d80958772fa1f4e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-06-16  Mario Lang  <mlang@delysid.org>
+
+       * chess-display.el (chess-display-move): Fix repainting when playing
+       against the internal engine (AI) which runs off the `post-move' game
+       event by adding a `redisplay' call just before the `post-move' emision.
+       (chess-display-select-piece): Use `chess-display-draw-square'.
+       (chess-display-draw-square): Make PIECE argument optional.
+
 2014-06-15  Mario Lang  <mlang@delysid.org>
 
        * chess-display.el (chess-display-draw-square): New function.
index 02874875a7f4f5cacb38a490ce0e3b2b89fbd64c..dfde36881de29e84bad1d7bb2fb0b27a5bfc290a 100644 (file)
@@ -355,11 +355,13 @@ also view the same game."
 (defun chess-display-draw-square (display index piece &optional pos)
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
-  (cl-check-type piece (member ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
+  (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
   (chess-with-current-buffer display
     (cl-check-type pos (or null (number ((point-min)) ((point-max)))))
     (funcall chess-display-event-handler 'draw-square
-            (or pos (chess-display-index-pos nil index)) piece index)))
+            (or pos (chess-display-index-pos nil index))
+            (or piece (chess-pos-piece (chess-display-position nil) index))
+            index)))
 
 (defun chess-display-paint-move (display ply)
   (cl-check-type display (or null buffer))
@@ -418,6 +420,7 @@ The position of PLY must match the currently displayed position."
          (chess-game-move chess-module-game ply)
          (chess-display-paint-move nil ply)
          (chess-display-set-index* nil (chess-game-index chess-module-game))
+         (redisplay)                   ; FIXME: This is clearly necessary, but why?
          (chess-game-run-hooks chess-module-game 'post-move))
       ;; jww (2002-03-28): This should beget a variation within the
       ;; game, or alter the game, just as SCID allows
@@ -1222,10 +1225,7 @@ Clicking once on a piece selects it; then click on the target location."
                                              position
                                              :index (cdr last-sel))))
                        (unless (= index coord)
-                         (funcall chess-display-event-handler 'draw-square
-                                (chess-display-index-pos nil index)
-                                (chess-pos-piece position index)
-                                index))))
+                         (chess-display-draw-square nil index))))
                    (setq chess-display-last-selected nil))
                (let ((piece (chess-pos-piece position coord)))
                  (cond