diff options
| -rw-r--r-- | TODO | 3 | ||||
| -rw-r--r-- | chess-display.el | 1 | ||||
| -rw-r--r-- | chess-engine.el | 2 | ||||
| -rw-r--r-- | chess-ics1.el | 11 | ||||
| -rw-r--r-- | chess-images.el | 11 | ||||
| -rw-r--r-- | chess-plain.el | 28 |
6 files changed, 36 insertions, 20 deletions
@@ -16,6 +16,9 @@ - Need a way to resign, request a draw, etc. +- Implement engine options; then, in chess-puzzle set the option that + tells the engine not to resign. + ---------------------------------------------------------------------- - Port image display code to XEmacs diff --git a/chess-display.el b/chess-display.el index f3c8662..995a6ec 100644 --- a/chess-display.el +++ b/chess-display.el @@ -106,6 +106,7 @@ (defun chess-display-set-perspective (display perspective) (chess-with-current-buffer display (setq chess-display-perspective perspective) + (erase-buffer) ; force a complete redraw (chess-display-update nil))) diff --git a/chess-engine.el b/chess-engine.el index eb61b17..23fedfd 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -146,7 +146,7 @@ (let ((proc (get-buffer-process (current-buffer)))) (if (and proc (memq (process-status proc) '(run open))) (process-send-string proc string) - (error "The engine you are using is no longer running"))))) + (error "The engine you're using is no longer running"))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/chess-ics1.el b/chess-ics1.el index 1d016c8..ef001f2 100644 --- a/chess-ics1.el +++ b/chess-ics1.el @@ -25,7 +25,7 @@ PERSPECTIVE is t for white or nil for black." (erase-buffer) (let* ((position (or disppos (chess-display-position nil))) (inverted (and (null disppos) - (null (chess-display-perspective nil)))) + (not (chess-display-perspective nil)))) (rank (if inverted 7 0)) (file (if inverted 7 0)) beg) @@ -67,11 +67,14 @@ PERSPECTIVE is t for white or nil for black." (defun chess-ics1-highlight (index &optional mode) (if (null (get-buffer-window (current-buffer) t)) (pop-to-buffer (current-buffer))) - (let (beg end) + (let ((inverted (not (chess-display-perspective nil))) + beg end) (save-excursion (goto-char (point-min)) - (goto-line (+ 3 (* 2 (chess-index-rank index)))) - (forward-char (+ 8 (* 4 (chess-index-file index)))) + (let ((rank (chess-index-rank index)) + (file (chess-index-file index))) + (goto-line (+ 3 (* 2 (if inverted (- 7 rank) rank)))) + (forward-char (+ 8 (* 4 (if inverted (- 7 file) file))))) (skip-chars-backward "^|") (setq beg (point)) (skip-chars-forward "^|") diff --git a/chess-images.el b/chess-images.el index 87ccf81..bbb4bb1 100644 --- a/chess-images.el +++ b/chess-images.el @@ -176,7 +176,7 @@ that specialized squares may be used such as marble tiles, etc." (chess-images-popup-board)) (let* ((inhibit-redisplay t) (board (chess-display-position nil)) - (inverted (null chess-display-perspective)) + (inverted (not (chess-display-perspective nil))) (rank (if inverted 7 0)) (file (if inverted 7 0)) (pos (point)) new beg) @@ -229,10 +229,13 @@ Common modes are: `unselected' show that the piece has been unselected." (if (null (get-buffer-window (current-buffer) t)) (chess-images-popup-board)) - (let* ((pos (save-excursion + (let* ((inverted (not (chess-display-perspective nil))) + (pos (save-excursion (goto-char (point-min)) - (goto-line (1+ (chess-index-rank index))) - (forward-char (* 2 (chess-index-file index))) + (let ((rank (chess-index-rank index)) + (file (chess-index-file index))) + (goto-line (1+ (if inverted (- 7 rank) rank))) + (forward-char (* 2 (if inverted (- 7 file) file)))) (point))) (highlight (copy-alist (get-text-property pos 'display)))) (setcar (last highlight) diff --git a/chess-plain.el b/chess-plain.el index 466ba9b..6b70e63 100644 --- a/chess-plain.el +++ b/chess-plain.el @@ -70,7 +70,7 @@ PERSPECTIVE is t for white or nil for black." (pos (point))) (erase-buffer) (let* ((position (chess-display-position nil)) - (inverted (null (chess-display-perspective nil))) + (inverted (not (chess-display-perspective nil))) (rank (if inverted 7 0)) (file (if inverted 7 0)) beg) @@ -119,16 +119,22 @@ PERSPECTIVE is t for white or nil for black." (defun chess-plain-highlight (index &optional mode) (if (null (get-buffer-window (current-buffer) t)) (pop-to-buffer (current-buffer))) - (save-excursion - (beginning-of-line) - (goto-line (if chess-plain-draw-border - (+ 2 (chess-index-rank index)) - (1+ (chess-index-rank index)))) - (forward-char (if chess-plain-draw-border - (1+ (chess-index-file index)) - (chess-index-file index))) - (put-text-property (point) (1+ (point)) 'face - 'chess-display-highlight-face))) + (let ((inverted (not (chess-display-perspective nil)))) + (save-excursion + (beginning-of-line) + (let ((rank (chess-index-rank index)) + (file (chess-index-file index))) + (if inverted + (setq rank (- 7 rank) + file (- 7 file))) + (goto-line (if chess-plain-draw-border + (+ 2 rank) + (1+ rank))) + (forward-char (if chess-plain-draw-border + (1+ file) + file))) + (put-text-property (point) (1+ (point)) 'face + 'chess-display-highlight-face)))) (provide 'chess-plain) |
