diff options
| author | John Wiegley <johnw@newartisans.com> | 2008-09-01 03:46:41 -0400 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2008-09-01 05:05:16 -0400 |
| commit | e02e36b9e62af44091cdf98c1ab4e153b5d55c82 (patch) | |
| tree | 20614434849ff1d753d930d0f3ba041e9340e46e /chess-ply.el | |
| parent | 2d588570a4a77246c33d025f8851c6c3ce2202b8 (diff) | |
Report a clearer error in the case of an algebraic queening move with an
unspecified promotion.
Diffstat (limited to 'chess-ply.el')
| -rw-r--r-- | chess-ply.el | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chess-ply.el b/chess-ply.el index f4c943c..165e9f5 100644 --- a/chess-ply.el +++ b/chess-ply.el @@ -160,7 +160,8 @@ (if long :long-castle :castle)))))) (chess-message-catalog 'english - '((pawn-promote-query . "Promote to queen? "))) + '((pawn-promote-query . "Promote to queen? ") + (ambiguous-promotion . "Promotion event without :promote keyword"))) (defvar chess-ply-checking-mate nil) (defvar chess-ply-allow-interactive-query nil) @@ -215,16 +216,16 @@ maneuver." ;; we haven't already been told, ask for the piece to ;; promote it to (when (and (not (memq :promote changes)) - (= (if color 0 7) (chess-index-rank (cadr changes)))) - ;; jww (2002-05-15): This does not always clear ALL - ;; input events - (discard-input) (sit-for 0) (discard-input) - (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")))) + (= (if color 0 7) + (chess-index-rank (cadr changes)))) + ;; This does not always clear ALL input events + (discard-input) (sit-for 0) (sleep-for 0 1) + (discard-input) + (unless chess-ply-allow-interactive-query + (chess-error 'ambiguous-promotion)) + (let ((new-piece (if (yes-or-no-p + (chess-string 'pawn-promote-query)) + ?Q ?N))) (nconc changes (list :promote (upcase new-piece))))) ;; is this an en-passant capture? |
