From: H.G. Muller Date: Sun, 1 Sep 2013 20:47:14 +0000 (+0200) Subject: Implement (inaccessible) dark squares X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=47b01ac7b7d35856fae5bef60de3255e8f0d4ae5 Implement (inaccessible) dark squares --- diff --git a/backend.c b/backend.c index 46e888e..f5ee841 100644 --- a/backend.c +++ b/backend.c @@ -17204,7 +17204,7 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) *p++ = '+'; piece = (ChessSquare)(DEMOTED piece); } - *p++ = PieceToChar(piece); + *p++ = (piece == DarkSquare ? '*' : PieceToChar(piece)); if(p[-1] == '~') { /* [HGM] flag promoted pieces as '~' (Crazyhouse) */ p[-1] = PieceToChar((ChessSquare)(DEMOTED piece)); @@ -17395,6 +17395,8 @@ ParseFEN (Board board, int *blackPlaysFirst, char *fen) while (emptycount--) board[i][(j++)+gameInfo.holdingsWidth] = EmptySquare; #endif + } else if (*p == '*') { + board[i][(j++)+gameInfo.holdingsWidth] = DarkSquare; p++; } else if (isdigit(*p)) { emptycount = *p++ - '0'; while(isdigit(*p)) emptycount = 10*emptycount + *p++ - '0'; /* [HGM] allow > 9 */ diff --git a/board.c b/board.c index d7c050b..48f075d 100644 --- a/board.c +++ b/board.c @@ -817,6 +817,7 @@ DrawSquare (int row, int column, ChessSquare piece, int do_flash) snprintf(tString, 3, "%d", piece); align = 4; // holdings count in upper-left corner } + if(piece == DarkSquare) square_color = 2; if(square_color == 2 || appData.blindfold) piece = EmptySquare; if (do_flash && piece != EmptySquare && appData.flashCount > 0) { diff --git a/common.h b/common.h index 9542276..65eaa9c 100644 --- a/common.h +++ b/common.h @@ -253,7 +253,7 @@ typedef enum { BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan, BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper, BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackKing, - EmptySquare, + EmptySquare, DarkSquare, NoRights, // [HGM] gamestate: for castling rights hidden in board[CASTLING] ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/ } ChessSquare; diff --git a/moves.c b/moves.c index 8cd3434..e6e8e1a 100644 --- a/moves.c +++ b/moves.c @@ -98,7 +98,7 @@ SameColor (ChessSquare piece1, ChessSquare piece2) (int) piece2 < (int) EmptySquare); } #else -#define SameColor(piece1, piece2) (piece1 < EmptySquare && piece2 < EmptySquare && (piece1 < BlackPawn) == (piece2 < BlackPawn)) +#define SameColor(piece1, piece2) (piece1 < EmptySquare && piece2 < EmptySquare && (piece1 < BlackPawn) == (piece2 < BlackPawn) || piece1 == DarkSquare || piece2 == DarkSquare) #endif char pieceToChar[] = { diff --git a/winboard/winboard.c b/winboard/winboard.c index 2b13222..e5df6db 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -3250,6 +3250,7 @@ BOOL HasHighlightInfo() } return result; + } BOOL IsDrawArrowEnabled() @@ -3441,6 +3442,7 @@ DrawBoardOnDC(HDC hdc, Board board, HDC tmphdc) DisplayHoldingsCount(hdc, x, y, flipView, (int) board[row][column]); else if( column == BOARD_RGHT) /* right align */ DisplayHoldingsCount(hdc, x, y, !flipView, (int) board[row][column]); + else if( piece == DarkSquare) DisplayHoldingsCount(hdc, x, y, 0, 0); else if (appData.monoMode) { if (piece == EmptySquare) {