From: H.G.Muller Date: Sun, 3 Jan 2016 11:38:18 +0000 (+0100) Subject: Let parsing of O-O castlings pay attention to castling rank X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a8b93f610b613be51a65986431e70c92625e340f;p=xboard.git Let parsing of O-O castlings pay attention to castling rank The parser assumed O-O and O-O-O castlings would always take place on the back rank, even when the newly introduced castlingRank array specified differently. --- diff --git a/parser.c b/parser.c index 91c8edd..7235cae 100644 --- a/parser.c +++ b/parser.c @@ -619,12 +619,12 @@ badMove:// we failed to find algebraic move if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ if (wom) { - rf = 0; - rt = 0; + rf = castlingRank[0]; + rt = castlingRank[0]; king = WhiteKing; } else { - rf = BOARD_HEIGHT-1; - rt = BOARD_HEIGHT-1; + rf = castlingRank[3]; + rt = castlingRank[3]; king = BlackKing; } ff = (BOARD_WIDTH-1)>>1; // this would be d-file diff --git a/parser.h b/parser.h index cd52f6b..2147f3c 100644 --- a/parser.h +++ b/parser.h @@ -63,3 +63,5 @@ extern char *yy_text; /* Needed because yytext can be either a char[] or a (non-constant) char* */ extern int yyoffset P((void)); extern signed char initialRights[BOARD_FILES]; +extern signed char castlingRank[BOARD_FILES]; +