From e6caf1ec343ad52eae616aa1a236d86e24b18fcb Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 11 Jan 2016 22:58:50 +0100 Subject: [PATCH] Fix parsing of OO castling when redefined A 'piece' command can redefine the castling stride of a King, and OO castling for non-Fischer castling is internally encoded as the King step, and thus has to know this. --- parser.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/parser.c b/parser.c index 7235cae..4cc2f03 100644 --- a/parser.c +++ b/parser.c @@ -22,6 +22,7 @@ #include "config.h" #include +#include #include #include #include "common.h" @@ -632,8 +633,12 @@ badMove:// we failed to find algebraic move /* ICS wild castling */ ft = castlingType == 1 ? BOARD_LEFT+1 : (gameInfo.variant == VariantJanus ? BOARD_RGHT-2 : BOARD_RGHT-3); } else { + char *q; ff = BOARD_WIDTH>>1; // e-file ft = castlingType == 1 ? BOARD_RGHT-2 : BOARD_LEFT+2; + if(pieceDesc[king] && (q = strchr(pieceDesc[king], 'O'))) { // redefined to non-default King stride + ft = (castlingType == 1 ? ff + atoi(q+1) : ff - atoi(q+1)); + } } if(PosFlags(0) & F_FRC_TYPE_CASTLING) { if (wom) { -- 1.7.0.4