Allow Duck move on PGN castling
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 18 Dec 2022 13:19:14 +0000 (14:19 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 18 Dec 2022 13:19:14 +0000 (14:19 +0100)
The parser now also scans for a Duck move after O-O or O-O-O.

parser.c

index 630a782..7e71619 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -706,6 +706,11 @@ badMove:// we failed to find algebraic move
                }
                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);
+               if(**p == ',' && gameInfo.variant == VariantDuck) {
+                   killX = (*p)[1] - AAA; killY = (*p)[2] - ONE;
+                   sprintf(currentMoveString + 4, ";%c%c", (*p)[1], (*p)[2]);
+                   *p += 3;
+               }
 
                return (int) LegalityTest(boards[yyboardindex],
                              PosFlags(yyboardindex)&~F_MANDATORY_CAPTURE, // [HGM] losers: e.p.!