From: H.G. Muller Date: Sat, 6 Nov 2010 18:55:31 +0000 (+0100) Subject: Fix bug in parsing illegal Pawn captures X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a9f394f721b7c2b69aed0f7fd8ddf01c197a8b09;p=xboard.git 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. --- 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]\)?)|[=+])? {