From 1cbcbea21edfadd359b82bc7891a4235070b1bd3 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 17 Apr 2012 19:45:33 +0200 Subject: [PATCH] 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. --- backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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; } -- 1.7.0.4