X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.c;h=4cc2f03d6d354ee7ba2071bb2ac48315f51f8aa9;hb=eff45351602b11217d119a3a0251f6dbf930107b;hp=13caa9f4270949dadff6208cb2534d5fedb0a2d7;hpb=0bf664e507241790adc9f419b24be4d1d5963b28;p=xboard.git diff --git a/parser.c b/parser.c index 13caa9f..4cc2f03 100644 --- a/parser.c +++ b/parser.c @@ -1,7 +1,7 @@ /* * parser.c -- * - * Copyright 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + * Copyright 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -22,6 +22,7 @@ #include "config.h" #include +#include #include #include #include "common.h" @@ -619,12 +620,12 @@ badMove:// we failed to find algebraic move if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ if (wom) { - rf = 0; - rt = 0; + rf = castlingRank[0]; + rt = castlingRank[0]; king = WhiteKing; } else { - rf = BOARD_HEIGHT-1; - rt = BOARD_HEIGHT-1; + rf = castlingRank[3]; + rt = castlingRank[3]; king = BlackKing; } ff = (BOARD_WIDTH-1)>>1; // this would be d-file @@ -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) {