summaryrefslogtreecommitdiff
path: root/chess-ply.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-09-01 00:27:40 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-09-01 00:27:40 -0400
commita2f1f41f720c5a78f4c76201da4e7fc9319d9bae (patch)
treef6fd8342526fb6e0f53415cf6b91516cacb32702 /chess-ply.el
parentc2058126f0bf3f44eb40fb462ce10842d60573a1 (diff)
Except for when making moves interactively (with chess-display-manual-move),
it is an error if a ply implies a promotion but not :promote keyword is passed to indication which piece to promote to.
Diffstat (limited to 'chess-ply.el')
-rw-r--r--chess-ply.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/chess-ply.el b/chess-ply.el
index 826151d..f4c943c 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -163,6 +163,7 @@
'((pawn-promote-query . "Promote to queen? ")))
(defvar chess-ply-checking-mate nil)
+(defvar chess-ply-allow-interactive-query nil)
(defsubst chess-ply-create* (position)
(assert (vectorp position))
@@ -218,9 +219,12 @@ maneuver."
;; jww (2002-05-15): This does not always clear ALL
;; input events
(discard-input) (sit-for 0) (discard-input)
- (let ((new-piece (if (yes-or-no-p
- (chess-string 'pawn-promote-query))
- ?Q ?N)))
+ (let ((new-piece
+ (if chess-ply-allow-interactive-query
+ (if (yes-or-no-p
+ (chess-string 'pawn-promote-query))
+ ?Q ?N)
+ (error "Promotion event without :promote keyword"))))
(nconc changes (list :promote (upcase new-piece)))))
;; is this an en-passant capture?