From a0769011c2a98841156559aa37978156766cc09f Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 10 Apr 2002 23:55:13 +0000 Subject: Added support for aborting a game. Use A or N from a display. --- chess-engine.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'chess-engine.el') diff --git a/chess-engine.el b/chess-engine.el index ba85444..189ad15 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -128,7 +128,7 @@ ;; accepting side (unless game (setq game (chess-engine-set-game nil (chess-game-create)))) - (chess-engine-set-start-position engine) + (chess-engine-set-start-position nil) t)) ((eq event 'setup-pos) @@ -159,6 +159,12 @@ (when game (chess-game-resign game) (chess-game-set-data game 'active nil) + t)) + + ((eq event 'abort) + (when game + (message "Your opponent has aborted the game") + (chess-game-set-data game 'active nil) t))))) (defun chess-engine-create (module &optional response-handler &rest args) @@ -311,6 +317,10 @@ function in all cases; this is merely a bandwidth-saver." (chess-with-current-buffer engine (chess-engine-command engine 'resign))) +(defun chess-engine-abort (engine) + (chess-with-current-buffer engine + (chess-engine-command engine 'abort))) + (defun chess-engine-send (engine string) "Send the given STRING to ENGINE." (chess-with-current-buffer engine @@ -372,7 +382,6 @@ function in all cases; this is merely a bandwidth-saver." (if chess-engine-last-pos (goto-char chess-engine-last-pos) (goto-char (point-min))) - (beginning-of-line) (while (not (eobp)) (let ((triggers chess-engine-regexp-alist)) (while triggers -- cgit v1.2.3