From 31f98bb9be6f40551d4dd66252c4b4579ecdbe83 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 10 Jan 2016 23:54:48 +0100 Subject: [PATCH] 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. --- backend.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/backend.c b/backend.c index bca59d4..db04b8e 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) { -- 1.7.0.4