Fix parsing of O-O castling in variant janus
[xboard.git] / parser.c
index 09bb390..de9ee25 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -144,7 +144,7 @@ int NextUnit(char **p)
 {      // Main parser routine
        int coord[4], n, result, piece, i;
        char type[4], promoted, separator, slash, *oldp, *commentEnd, c;
-        int wom = WhiteOnMove(yyboardindex);
+        int wom = quickFlag ? quickFlag&1 : WhiteOnMove(yyboardindex);
 
        // ********* try white first, because it is so common **************************
        if(**p == ' ' || **p == '\n' || **p == '\t') { parseStart = (*p)++; return Nothing; }
@@ -356,7 +356,7 @@ badMove:// we failed to find algebraic move
                ff = (BOARD_WIDTH-1)>>1; // this would be d-file
                if (boards[yyboardindex][rf][ff] == king) {
                    /* ICS wild castling */
-                   ft = castlingType == 1 ? BOARD_LEFT+1 : BOARD_RGHT-3;
+                   ft = castlingType == 1 ? BOARD_LEFT+1 : (gameInfo.variant == VariantJanus ? BOARD_RGHT-2 : BOARD_RGHT-3);
                } else {
                    ff = BOARD_WIDTH>>1; // e-file
                    ft = castlingType == 1 ? BOARD_RGHT-2 : BOARD_LEFT+2;