From: H.G.Muller Date: Mon, 1 Feb 2016 20:51:04 +0000 (+0100) Subject: Fix castling rights X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9337560fbda4278a04213d85947445218fd01621;p=xboard.git Fix castling rights The expansion of the number of piece types to > 64 had broken the accounting of castling rights, because the code for NoRights is also a piece code (as it is stored in the board), and had gotten a value so high that it could no longer be stored as signed char. This is solved by declaring the initialRights array as unsigned char instead. --- diff --git a/backend.c b/backend.c index 6fca83d..38b4e54 100644 --- a/backend.c +++ b/backend.c @@ -516,7 +516,7 @@ AppData appData; Board boards[MAX_MOVES]; /* [HGM] Following 7 needed for accurate legality tests: */ signed char castlingRank[BOARD_FILES]; // and corresponding ranks -signed char initialRights[BOARD_FILES]; +unsigned char initialRights[BOARD_FILES]; int nrCastlingRights; // For TwoKings, or to implement castling-unknown status int initialRulePlies, FENrulePlies; FILE *serverMoves = NULL; // next two for broadcasting (/serverMoves option) diff --git a/moves.c b/moves.c index f00e712..67a23ac 100644 --- a/moves.c +++ b/moves.c @@ -71,7 +71,6 @@ int BlackPiece P((ChessSquare)); int SameColor P((ChessSquare, ChessSquare)); int PosFlags(int index); -extern signed char initialRights[BOARD_FILES]; /* [HGM] all rights enabled, set in InitPosition */ int quickFlag; char *pieceDesc[EmptySquare]; char *defaultDesc[EmptySquare] = { diff --git a/parser.h b/parser.h index 2147f3c..87226f1 100644 --- a/parser.h +++ b/parser.h @@ -62,6 +62,6 @@ extern int yyskipmoves; /* If TRUE, all moves are reported as AmbiguousMove 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 unsigned char initialRights[BOARD_FILES]; extern signed char castlingRank[BOARD_FILES];