X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.c;h=797a40cdda286f7fb40c889f51dcd0621f5b30b9;hb=refs%2Fheads%2Fv4.9.x;hp=0938242c37449bb9bdd18a7f08336d7dc00643df;hpb=22be362b5abb0d3993d75763fda5112b47287cca;p=xboard.git diff --git a/parser.c b/parser.c index 0938242..797a40c 100644 --- a/parser.c +++ b/parser.c @@ -642,9 +642,12 @@ badMove:// we failed to find algebraic move Match("OO", p) || Match("oo", p) || Match("00", p)) castlingType = 1; if(castlingType) { //code from old parser, collapsed for both castling types, and streamlined a bit int rf, ff, rt, ft; ChessSquare king; - char promo=NULLCHAR; + char promo=NULLCHAR, gate = 0; - if(gameInfo.variant == VariantSChess) promo = PromoSuffix(p); + if(gameInfo.variant == VariantSChess) { + promo = PromoSuffix(p); + if(promo && **p >= 'a' && **p < AAA + BOARD_RGHT) gate = *(*p)++; + } if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ @@ -680,6 +683,12 @@ badMove:// we failed to find algebraic move if (appData.debugMode) fprintf(debugFP, "Parser FRC (type=%d) %d %d\n", castlingType, ff, ft); if(ff == NoRights || ft == NoRights) return ImpossibleMove; } + if(gate) { // gating disambiguator present + if(gate != ff + AAA) { + int h = ft; ft = ff; ff = h; // reverse for gating at Rook square + if(gate != AAA + initialRights[castlingType+(wom?-1:2)]) return ImpossibleMove; + } + } sprintf(currentMoveString, "%c%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE,promo); if (appData.debugMode) fprintf(debugFP, "(%d-type) castling %d %d\n", castlingType, ff, ft);