diff options
| author | dickmao <dick.r.chiang@gmail.com> | 2018-08-27 17:00:35 -0400 |
|---|---|---|
| committer | dickmao <dick.r.chiang@gmail.com> | 2018-09-06 09:24:10 -0400 |
| commit | 3222b53d942daa404852e5148ba9d3ebb8fe96d0 (patch) | |
| tree | 37e2af6242423e57adbbc1238433f58c92ac9bd0 /chess-engine.el | |
| parent | 67339d896aa65d75272b80134a8128276c8c6a0f (diff) | |
Pre-moves
To activate, look for Chess Display Allow Pre Moves in:
M-x customize-group
chess-display
Tested via:
make test
make test24 (requires evim)
Diffstat (limited to 'chess-engine.el')
| -rw-r--r-- | chess-engine.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/chess-engine.el b/chess-engine.el index 0ac7541..2d6068a 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -130,21 +130,23 @@ If conversion fails, this function fired an 'illegal event." ((eq event 'pass) (when (chess-game-data game 'active) - (chess-message 'move-passed) + (let ((chess-engine-handling-event t)) + (chess-engine-set-position nil (car args) t)) t)) ((eq event 'match) (if (chess-game-data game 'active) (chess-engine-command nil 'busy) (let ((name (> (length (car args)) 0))) - (if (y-or-n-p (if name - (chess-string 'want-to-play (car args)) - (chess-string 'want-to-play-a))) + (if (or noninteractive + (y-or-n-p (if name + (chess-string 'want-to-play (car args)) + (chess-string 'want-to-play-a)))) (progn - (setq chess-engine-opponent-name (or name "Anonymous")) + (setq chess-engine-opponent-name (if name (car args) "Anonymous")) (let ((chess-engine-handling-event t)) (chess-engine-set-position nil)) - (chess-engine-command nil 'accept name)) + (chess-engine-command nil 'accept chess-full-name)) (chess-engine-command nil 'decline)))) t) @@ -213,12 +215,11 @@ If conversion fails, this function fired an 'illegal event." (when chess-engine-pending-offer (if (eq chess-engine-pending-offer 'match) (unless (chess-game-data game 'active) - (let ((name (and (> (length (car args)) 0) - (car args)))) + (let ((name (> (length (car args)) 0))) (if name - (chess-message 'opp-ready (car args)) + (chess-message 'opp-ready (car args)) (chess-message 'opp-ready-a)) - (setq chess-engine-opponent-name (or name "Anonymous")) + (setq chess-engine-opponent-name (if name (car args) "Anonymous")) (let ((chess-engine-handling-event t)) (chess-engine-set-position nil)))) (let ((chess-engine-handling-event t)) |
