summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-12 11:09:04 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-12 11:09:04 +0000
commit30692f15986c90f7b776c83e2de142738d6161d6 (patch)
tree18c7796f3cdcd99d757eed75af8ff3f692ad60d8
parentee6f32e0f33a42f09aca27d00d57c22f35192c76 (diff)
*** no comment ***
-rw-r--r--TODO5
-rw-r--r--chess-ics.el35
-rw-r--r--chess-sound.el7
3 files changed, 26 insertions, 21 deletions
diff --git a/TODO b/TODO
index 05f555a..3831f0c 100644
--- a/TODO
+++ b/TODO
@@ -20,6 +20,9 @@
- when announcing abiguous pieces, name the rank/file ("e pawn")
+- there needs to be much more robustness; it's too easy to get the
+ game into an unplayable state right now
+
----------------------------------------------------------------------
- Read-only mode needs to be a bit more vigorous. There's nothing
@@ -40,7 +43,7 @@
chess games back and forth. Add code for special MIME handling of
this type in Gnus.
-- Clean/rewrite ics.el
+- Copy some of ics.el's nicer functionality into chess-ics.el
- Add support for ICS observing
diff --git a/chess-ics.el b/chess-ics.el
index 9cc8933..300ecaf 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -129,23 +129,24 @@ who is black."
(info (chess-ics12-parse (match-string 3)))
(game (chess-engine-game nil)))
(assert game)
- (unwind-protect
- (if (and (chess-game-data game 'active)
- (> (chess-game-index game) 0))
- (if (and (cadr info)
- (eq (chess-pos-side-to-move (car info))
- (chess-game-data game 'my-color)))
- (chess-engine-do-move
- (chess-algebraic-to-ply
- (chess-ply-pos (car (last (chess-game-plies game))))
- (cadr info) t)))
- (let ((chess-game-inhibit-events t) plies)
- (chess-game-set-data game 'my-color (string= (nth 2 info)
- chess-ics-handle))
- (chess-game-set-data game 'active t)
- (chess-game-set-start-position game (car info)))
- (chess-game-run-hooks game 'orient))
- (delete-region begin end))
+ (if (and (chess-game-data game 'active)
+ (> (chess-game-index game) 0))
+ (when (and (cadr info)
+ (eq (chess-pos-side-to-move (car info))
+ (chess-game-data game 'my-color)))
+ (chess-engine-do-move
+ (chess-algebraic-to-ply
+ (chess-ply-pos (car (last (chess-game-plies game))))
+ (cadr info) t))
+ (assert (equal (chess-engine-position nil)
+ (car info))))
+ (let ((chess-game-inhibit-events t) plies)
+ (chess-game-set-data game 'my-color (string= (nth 2 info)
+ chess-ics-handle))
+ (chess-game-set-data game 'active t)
+ (chess-game-set-start-position game (car info)))
+ (chess-game-run-hooks game 'orient))
+ (delete-region begin end)
t))
(defvar chess-ics-regexp-alist
diff --git a/chess-sound.el b/chess-sound.el
index 666be6c..6c31a9d 100644
--- a/chess-sound.el
+++ b/chess-sound.el
@@ -46,7 +46,7 @@
(defun chess-sound-for-game (game)
"Announce the opponent's moves in GAME."
- (chess-game-add-hook game 'chess-sound-event-handler))
+ (chess-game-add-hook game 'chess-sound-handler))
(defun chess-sound (ch)
(let ((file
@@ -61,9 +61,10 @@
(expand-file-name file chess-sound-directory))))
(defun chess-sound-play (file)
- (apply 'call-process chess-sound-program nil nil nil chess-sound-args))
+ (apply 'call-process chess-sound-program
+ nil nil nil (append chess-sound-args (list file))))
-(defun chess-sound-event-handler (game ignore event &rest args)
+(defun chess-sound-handler (game ignore event &rest args)
"This display module presents a standard chessboard.
See `chess-display-type' for the different kinds of displays."
(cond