From a9f394f721b7c2b69aed0f7fd8ddf01c197a8b09 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 6 Nov 2010 19:55:31 +0100 Subject: [PATCH] Fix bug in parsing illegal Pawn captures When a pawn move of type exf5 was illegal, the parser made an attempt to interpret it as e.p. capture of f5. This, however, messed up the move, so that it was now permanently mistaken for e5xf6. Even in cases with legality testing off, where you would want the original move to be accepted despite the fact that it was illegal. --- parser.l | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/parser.l b/parser.l index 96a9e8b..ac66581 100644 --- a/parser.l +++ b/parser.l @@ -584,8 +584,12 @@ extern void CopyBoard P((Board to, Board from)); if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant) return (int) result; - else + else { // [HGM] all very nice, but this messed up the input move that we might want to accept with legality testing off... + if (WhiteOnMove(yyboardindex)) // undo the damage + currentMoveString[1]--, currentMoveString[3]--; + else currentMoveString[1]++, currentMoveString[3]++; return (int) IllegalMove; + } } "+"?[A-Z][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|[=+])? { -- 1.7.0.4