diff options
| author | John Wiegley <johnw@newartisans.com> | 2008-08-29 06:30:47 -0400 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2008-08-29 06:30:47 -0400 |
| commit | a62df1708858bf33845191fefeadf0bbf8cc48ae (patch) | |
| tree | 1ae988a2b4475120fa7752af3a412990909bb7b9 /chess-ics.el | |
| parent | ce58cd79f510f5d9c8d84fd1fc63c8ff14984a9b (diff) | |
Instead of ignoring ICS refresh commands, use them as a chance to ensure that
what we think is the current game position really is.
Diffstat (limited to 'chess-ics.el')
| -rw-r--r-- | chess-ics.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/chess-ics.el b/chess-ics.el index e5c2ccb..19b0c5e 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -597,17 +597,27 @@ See `chess-ics-game'.") (chess-game-move game ply) (setq error nil)) (if (= index (chess-game-index game)) - (setq error nil) ; Ignore a "refresh" command + ;; this is a refresh, which we can use to verify that our + ;; notion of the game's current position is correct + (let ((their-fen (chess-pos-to-fen position)) + (our-fen (chess-pos-to-fen (chess-game-pos game)))) + (if (string= their-fen our-fen) + (setq error nil) ; ignore the refresh + (setq error + (format "comparing-position (%s != %s)" + their-fen our-fen)))) (if (and (> index (1+ (chess-game-index game))) (= 1 (chess-game-seq game))) - ;; we lack a complete game, try to get it via the movelist + ;; we lack a complete game, try to get it via the + ;; movelist (progn (setq error nil) (chess-ics-send (format "moves %d" (chess-game-data game 'ics-game-number)))) (setq error - (format "comparing-index (%d:%d)" index (chess-game-index game)))))) + (format "comparing-index (%d:%d)" + index (chess-game-index game)))))) ;; no preceeding ply supplied, so this is a starting position (let ((chess-game-inhibit-events t) (color (chess-pos-side-to-move position)) |
