emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 01/01: * chess-display.el (chess-display-move): Fix repainting wh


From: Mario Lang
Subject: [elpa] 01/01: * 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.
Date: Sun, 15 Jun 2014 23:10:15 +0000

mlang pushed a commit to branch externals/chess
in repository elpa.

commit 9b32e8a76fa91acb7a33f4227833280398741168
Author: Mario Lang <address@hidden>
Date:   Mon Jun 16 01:08:48 2014 +0200

    * 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.
---
 ChangeLog        |    8 ++++++++
 chess-display.el |   12 ++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 436fe5b..621a5c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-06-16  Mario Lang  <address@hidden>
+
+       * 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  <address@hidden>
 
        * chess-display.el (chess-display-draw-square): New function.
diff --git a/chess-display.el b/chess-display.el
index 0287487..dfde368 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]