diff options
| -rw-r--r-- | TODO | 10 | ||||
| -rw-r--r-- | chess-display.el | 9 | ||||
| -rw-r--r-- | chess-ply.el | 9 |
3 files changed, 15 insertions, 13 deletions
@@ -54,18 +54,8 @@ - Let the user specify a default size for the chess-images display -- chess-display-highlight should accept a list of positions and modes - to highlight. Use keywords for the modes. - - allow dragging of pieces -- add a shuffle chess position generator - -- add chess-ply-has-keyword, as a shorthand for using memq on the - changes. - -- add chess-ply-move-source and chess-ply-move-target - ---------------------------------------------------------------------- - Port image display code to XEmacs diff --git a/chess-display.el b/chess-display.el index 7c488d6..0d53548 100644 --- a/chess-display.el +++ b/chess-display.el @@ -261,15 +261,18 @@ If only START is given, it must be in algebraic move notation." (setq chess-display-position (chess-ply-next-pos ply)))) (chess-display-update nil))) -(defun chess-display-highlight (display index &optional mode) +(defun chess-display-highlight (display &rest args) "Highlight the square at INDEX on the current position. The given highlighting MODE is used, or the default if the style you are displaying with doesn't support that mode. `selected' is a mode that is supported by most displays, and is the default mode." (chess-with-current-buffer display (if chess-display-highlight-function - (funcall chess-display-highlight-function index - (or mode 'selected))))) + (let ((mode :selected)) + (dolist (arg args) + (if (symbolp arg) + (setq mode arg) + (funcall chess-display-highlight-function arg mode))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/chess-ply.el b/chess-ply.el index 57c2451..adbeeed 100644 --- a/chess-ply.el +++ b/chess-ply.el @@ -62,6 +62,15 @@ (defsubst chess-ply-set-changes (ply changes) (setcdr ply changes)) +(defsubst chess-ply-has-keyword (ply keyword) + (memq keyword (chess-ply-changes))) + +(defsubst chess-ply-source (ply) + (car (chess-ply-changes))) + +(defsubst chess-ply-target (ply) + (cadr (chess-ply-changes))) + (defsubst chess-ply-next-pos (ply) (apply 'chess-pos-move (chess-pos-copy (chess-ply-pos ply)) (chess-ply-changes ply))) |
