diff options
| author | Mario Lang <mlang@delysid.org> | 2014-04-20 02:41:33 +0200 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2014-04-20 02:41:33 +0200 |
| commit | 0a3b1be05fdb6e813ad989ef55ea5e716956f4f7 (patch) | |
| tree | 2a1fe5c80ae184e6b89cbd2762726d45e52d4f7f | |
| parent | 202da3e20423ce92db6aaa59d3b247b054c79926 (diff) | |
chess-pos.el: Convert 3 more chess-incr-index calls to chess-next-index.
| -rw-r--r-- | chess-pos.el | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/chess-pos.el b/chess-pos.el index 758d810..3031717 100644 --- a/chess-pos.el +++ b/chess-pos.el @@ -851,12 +851,16 @@ If NO-CASTLING is non-nil, do not consider castling moves." (let ((ep (chess-pos-en-passant position))) (when ep (= ep (chess-next-index target backward)))) - (or (and (setq pos (chess-incr-index target - (if color 1 -1) -1)) + (or (and (setq pos (chess-next-index target + (if color + chess-direction-southwest + chess-direction-northeast))) (chess-pos-piece-p position pos (if color ?P ?p))) - (and (setq pos (chess-incr-index target - (if color 1 -1) 1)) + (and (setq pos (chess-next-index target + (if color + chess-direction-southeast + chess-direction-northwest))) (chess-pos-piece-p position pos (if color ?P ?p))))) (if color (> p ?a) (< p ?a))) @@ -983,9 +987,11 @@ in check)." (setq other-piece (chess-pos-piece position target)) (chess-pos-set-piece position target piece) (when (and (= piece (if color ?P ?p)) - (chess-pos-en-passant position) - (= (chess-pos-en-passant position) - (chess-incr-index target (if color 1 -1) 0))) + (let ((ep (chess-pos-en-passant position))) + (when ep + (= ep (chess-next-index target (if color + chess-direction-south + chess-direction-north)))))) (chess-pos-set-piece position (setq en-passant-square (chess-incr-index target |
