don't ignore winboard/parser.c
[xboard.git] / backend.c
index 910d1d8..face7f1 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -4627,11 +4627,6 @@ InitPosition(redraw)
       break;\r
     case VariantTwoKings:\r
       pieces = twoKingsArray;\r
-      nrCastlingRights = 8;                 /* add rights for second King */\r
-      castlingRights[0][6] = initialRights[2] = 5;\r
-      castlingRights[0][7] = initialRights[5] = 5;\r
-      castlingRank[6] = 0;\r
-      castlingRank[7] = BOARD_HEIGHT-1;\r
       break;\r
     case VariantCapaRandom:\r
       shuffleOpenings = TRUE;\r
@@ -5881,7 +5876,8 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                    }\r
                 }\r
 \r
-                if( NrPieces == 2 || gameInfo.variant != VariantXiangqi &&\r
+                if( NrPieces == 2 || gameInfo.variant != VariantXiangqi && \r
+                                    gameInfo.variant != VariantShatranj && // [HGM] baring will remain possible\r
                        (NrPieces == 3 && NrWN+NrBN+NrWB+NrBB == 1 ||\r
                         NrPieces == NrBB+NrWB+2 && bishopsColor != 3)) // [HGM] all Bishops (Ferz!) same color\r
                 {    /* KBK, KNK, KK of KBKB with like Bishops */\r
@@ -7831,7 +7827,9 @@ GameEnds(result, resultDetails, whosays)
            }\r
            /* [HGM] bare: don't allow bare King to win */\r
            if((gameInfo.holdingsWidth == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)\r
-                        && result != GameIsDrawn)\r
+              && gameInfo.variant != VariantLosers && gameInfo.variant != VariantGiveaway \r
+              && gameInfo.variant != VariantSuicide // [HGM] losers: except in losers, of course...\r
+              && result != GameIsDrawn)\r
            {   int i, j, k=0, color = (result==WhiteWins ? (int)WhitePawn : (int)BlackPawn);\r
                for(j=BOARD_LEFT; j<BOARD_RGHT; j++) for(i=0; i<BOARD_HEIGHT; i++) {\r
                        int p = (int)boards[forwardMostMove][i][j] - color;\r
@@ -12400,8 +12398,9 @@ ParseOption(Option *opt, ChessProgramState *cps)
        } else return FALSE;\r
        *p = 0; // terminate option name\r
        // now look if the command-line options define a setting for this engine option.\r
-       p = strstr(cps->optionSettings, opt->name);\r
-       if(p == cps->optionSettings || p[-1] == ',') {\r
+       if(cps->optionSettings && cps->optionSettings[0])\r
+           p = strstr(cps->optionSettings, opt->name); else p = NULL;\r
+       if(p && (p == cps->optionSettings || p[-1] == ',')) {\r
                sprintf(buf, "option %s", p);\r
                if(p = strstr(buf, ",")) *p = 0;\r
                strcat(buf, "\n");\r