From: H.G. Muller Date: Tue, 17 Apr 2012 17:45:33 +0000 (+0200) Subject: Fix faking of castling rights after editing position with holdings X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1cbcbea21edfadd359b82bc7891a4235070b1bd3;p=xboard.git Fix faking of castling rights after editing position with holdings The queen-side rook was always imagined at X=0, which is in the holdings when these exist, so that Q-side castling in such games was never allowed after EditPosition. --- diff --git a/backend.c b/backend.c index 634b710..f86a60e 100644 --- a/backend.c +++ b/backend.c @@ -13932,11 +13932,11 @@ EditPositionDone (Boolean fakeRights) boards[0][EP_STATUS] = EP_NONE; boards[0][CASTLING][2] = boards[0][CASTLING][5] = BOARD_WIDTH>>1; if(boards[0][0][BOARD_WIDTH>>1] == king) { - boards[0][CASTLING][1] = boards[0][0][BOARD_LEFT] == WhiteRook ? 0 : NoRights; + boards[0][CASTLING][1] = boards[0][0][BOARD_LEFT] == WhiteRook ? BOARD_LEFT : NoRights; boards[0][CASTLING][0] = boards[0][0][BOARD_RGHT-1] == WhiteRook ? BOARD_RGHT-1 : NoRights; } else boards[0][CASTLING][2] = NoRights; if(boards[0][BOARD_HEIGHT-1][BOARD_WIDTH>>1] == WHITE_TO_BLACK king) { - boards[0][CASTLING][4] = boards[0][BOARD_HEIGHT-1][BOARD_LEFT] == BlackRook ? 0 : NoRights; + boards[0][CASTLING][4] = boards[0][BOARD_HEIGHT-1][BOARD_LEFT] == BlackRook ? BOARD_LEFT : NoRights; boards[0][CASTLING][3] = boards[0][BOARD_HEIGHT-1][BOARD_RGHT-1] == BlackRook ? BOARD_RGHT-1 : NoRights; } else boards[0][CASTLING][5] = NoRights; }