From 9b32e8a76fa91acb7a33f4227833280398741168 Mon Sep 17 00:00:00 2001 From: Mario Lang Date: Mon, 16 Jun 2014 01:08:48 +0200 Subject: [PATCH] * 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 436fe5b6f..621a5c464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-06-16 Mario Lang + + * 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 * chess-display.el (chess-display-draw-square): New function. diff --git a/chess-display.el b/chess-display.el index 02874875a..dfde36881 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 -- 2.39.2