From: H.G.Muller Date: Sun, 10 Jan 2016 22:54:48 +0000 (+0100) Subject: Never castle when King has other initial moves X-Git-Url: http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=commitdiff_plain;h=31f98bb9be6f40551d4dd66252c4b4579ecdbe83 Never castle when King has other initial moves The ApplyMove routine assumed that any lateral King step of more than a single square was a castling, and then swung the nearest piece in that direction around the King. This failed in Grande Acedrex, where the King can (amongst others) jump 2 squares sideways as an initial move. So we now first check if the King has its moves redefined in a way that does specify no castling but does specify other initial moves, and perform any move as just a simple King move in that case. --- diff --git a/backend.c b/backend.c index bca59d44..db04b8e2 100644 --- a/backend.c +++ b/backend.c @@ -10115,6 +10115,9 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) } /* End of code added by Tord */ + } else if (pieceDesc[piece] && piece == king && !strchr(pieceDesc[piece], 'O') && strchr(pieceDesc[piece], 'i')) { + board[fromY][fromX] = EmptySquare; // never castle if King has virgin moves defined on it other than castling + board[toY][toX] = piece; } else if (board[fromY][fromX] == king && fromX != BOARD_LEFT && fromX != BOARD_RGHT-1 // [HGM] cylinder */ && toY == fromY && toX > fromX+1) {