summaryrefslogtreecommitdiff
path: root/chess-engine.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-06-14 23:41:56 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-06-14 23:41:56 +0000
commit36f7cba0c4eb6535f170c7b8957e414dd3b91499 (patch)
tree006e030a0254726259e80ad700c8088ce307b6b0 /chess-engine.el
parent5badda2b5c155f5afbd238c97d5ca93b075e2ac5 (diff)
various small bug fixes
Diffstat (limited to 'chess-engine.el')
-rw-r--r--chess-engine.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/chess-engine.el b/chess-engine.el
index 8756962..be4aa64 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -265,9 +265,11 @@
((eq event 'call-flag)
(let ((remaining
- (chess-game-data game (if (chess-game-data game 'my-color)
- 'white-remaining
- 'black-remaining))))
+ (if (car args)
+ -1
+ (chess-game-data game (if (chess-game-data game 'my-color)
+ 'white-remaining
+ 'black-remaining)))))
(when (< remaining 0)
(chess-message 'opp-call-flag)
(chess-game-run-hooks game 'flag-fell))))
@@ -297,11 +299,10 @@
(intern (concat (symbol-name module) "-regexp-alist"))))
chess-engine-response-handler
(or response-handler 'chess-engine-default-handler))
- (let ((proc (get-buffer-process (current-buffer))))
- (when (processp proc)
+ (let ((proc chess-engine-process))
+ (when (and proc (processp proc))
(unless (memq (process-status proc) '(run open))
(chess-error 'failed-engine-start))
- (setq chess-engine-process proc)
(unless (process-filter proc)
(set-process-filter proc 'chess-engine-filter)))
(setq chess-engine-current-marker (point-marker))
@@ -375,7 +376,7 @@
"Submit the given STRING, so ENGINE sees it in its input stream."
(chess-with-current-buffer engine
(let ((proc chess-engine-process))
- (when (and (processp proc)
+ (when (and proc (processp proc)
(not (memq (process-status proc) '(run open))))
(chess-message 'engine-not-running)
(chess-engine-command nil 'destroy))
@@ -393,7 +394,7 @@
(defun chess-engine-filter (proc &optional string)
"Filter for receiving text for an engine from an outside source."
- (let ((buf (if (processp proc)
+ (let ((buf (if (and proc (processp proc))
(process-buffer proc)
(current-buffer)))
last-point)