summaryrefslogtreecommitdiff
path: root/chess-pgn.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-18 18:30:19 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-18 18:30:19 +0000
commit563cf2037068f67f6786172b029363aaa7d52776 (patch)
tree549c69928ccc019093fed062f6999462fbb431db /chess-pgn.el
parent2b0db13d4cdc3aaadd7dd458c1097c668577a072 (diff)
Many efficiency improvements and bug fixes.
Diffstat (limited to 'chess-pgn.el')
-rw-r--r--chess-pgn.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/chess-pgn.el b/chess-pgn.el
index 41abf86..672244b 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -38,7 +38,7 @@
(chess-game-set-tag game "Result" (match-string-no-properties 0))
(unless (eq t (car (last plies)))
(nconc plies (list (chess-ply-create*
- (chess-ply-next-pos (car (last plies))) t))))
+ (chess-ply-next-pos (car (last plies)))))))
(throw 'done t))
((looking-at "{")
@@ -52,7 +52,7 @@
(forward-char)
(skip-chars-forward " \t\n")
(chess-pos-add-annotation
- prevpos (chess-pgn-read-plies game (chess-pos-copy prevpos))))
+ prevpos (chess-pgn-read-plies game prevpos)))
((and (not top-level)
(looking-at ")"))
@@ -61,7 +61,7 @@
(t
(nconc plies (list (chess-ply-create*
- (chess-ply-next-pos (car (last plies))) t)))
+ (chess-ply-next-pos (car (last plies))))))
(throw 'done t)))
(skip-chars-forward " \t\n")))
(cdr plies)))
@@ -84,16 +84,14 @@
(chess-game-set-tag game (match-string-no-properties 1)
(read (match-string-no-properties 2)))
(goto-char (match-end 0)))
- (let ((fen (chess-game-tag game "FEN")))
+ (let* ((fen (chess-game-tag game "FEN"))
+ (position (if fen
+ (chess-fen-to-pos fen)
+ chess-starting-position)))
(chess-game-set-plies
- game (or (chess-pgn-read-plies
- game (if fen
- (chess-fen-to-pos fen)
- (chess-pos-copy chess-starting-position)) t)
+ game (or (chess-pgn-read-plies game position t)
;; set the starting position to the FEN string
- (list (chess-ply-create* (if fen
- (chess-fen-to-pos fen)
- chess-starting-position) fen)))))
+ (list (chess-ply-create* position)))))
game)))
(defun chess-pgn-insert-annotations (game index ply)