From: H.G. Muller Date: Sun, 12 Jul 2009 01:20:56 +0000 (-0700) Subject: fixed parser error for knight move X-Git-Tag: v4.4.0.beta1~32 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=fbaf2c67f80ae9a26950a0754128f0e366aea862;p=xboard.git fixed parser error for knight move The parser had a strange quirk: it recognized bd2 as a valid Knight move (Nb1-d2) while this SAN format should be reserved for Pawn moves only. --- diff --git a/parser.l b/parser.l index 29a2fa9..0d60813 100755 --- a/parser.l +++ b/parser.l @@ -470,9 +470,13 @@ extern void CopyBoard P((Board to, Board from)); if (WhiteOnMove(yyboardindex)) { if (yytext[2+skip] == ONE) return (int) ImpossibleMove; currentMoveString[1] = yytext[2+skip] - 1; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != WhitePawn) + return ImpossibleMove; } else { currentMoveString[1] = currentMoveString[3] + 1; if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; + if(boards[yyboardindex][currentMoveString[1]-ONE][currentMoveString[0]-AAA] != BlackPawn) + return ImpossibleMove; } if (yyleng-skip > 3) { if (yytext[yyleng-1] == ')')