X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=f465f95c07fe27d7a5f31e5eca23a7ffc7c2f1a5;hb=bc82c5edb1fefc925642a5b19e4a96caa92f76e3;hp=776f7516d44c89a8b6373ba5654374e6d0435fe5;hpb=84fa2420dd1ef644ed41ab4d46aa62e02365a5ba;p=xboard.git diff --git a/backend.c b/backend.c index 776f751..f465f95 100644 --- a/backend.c +++ b/backend.c @@ -1600,6 +1600,7 @@ InitBackEnd3 P((void)) char buf[MSG_SIZ]; int err, len; + ParseFeatures(appData.features[0], &first); if(!appData.icsActive && !appData.noChessProgram && !appData.matchMode && // mode involves only first engine !strcmp(appData.variant, "normal") && // no explicit variant request appData.NrRanks == -1 && appData.NrFiles == -1 && appData.holdingsSize == -1 && // no size overrides requested @@ -10212,14 +10213,14 @@ ParseGameHistory (char *game) void ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) { - ChessSquare captured = board[toY][toX], piece, pawn, king, killed, killed2; int p, rookX, oldEP, epRank, berolina = 0; + ChessSquare captured = board[toY][toX], piece, pawn, king, killed, killed2; int p, rookX, oldEP, epRank, epFile, berolina = 0; int promoRank = gameInfo.variant == VariantMakruk || gameInfo.variant == VariantGrand || gameInfo.variant == VariantChuChess ? 3 : 1; /* [HGM] compute & store e.p. status and castling rights for new position */ /* we can always do that 'in place', now pointers to these rights are passed to ApplyMove */ if(gameInfo.variant == VariantBerolina) berolina = EP_BEROLIN_A; - oldEP = (signed char)board[EP_FILE]; epRank = board[EP_RANK]; + oldEP = (signed char)board[EP_FILE]; epRank = board[EP_RANK]; epFile = board[EP_FILE]; board[EP_STATUS] = EP_NONE; board[EP_FILE] = board[EP_RANK] = 100; @@ -10253,6 +10254,13 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) } pawn = board[fromY][fromX]; + if(pieceDesc[pawn] && strchr(pieceDesc[pawn], 'e')) { // piece with user-defined e.p. capture + if(captured == EmptySquare && toX == epFile && (toY == (epRank & 127) || toY + (pawn < BlackPawn ? -1 : 1) == epRank - 128)) { + captured = board[epRank + (pawn < BlackPawn ? -1 : 1)][oldEP & berolina-1]; // remove victim + board[epRank + (pawn < BlackPawn ? -1 : 1)][oldEP & berolina-1] = EmptySquare; + pawn = EmptySquare; // kludge to suppress old e.p. code + } + } if( pawn == WhiteLance || pawn == BlackLance ) { if( gameInfo.variant != VariantSuper && gameInfo.variant != VariantChu ) { if(gameInfo.variant == VariantSpartan) board[EP_STATUS] = EP_PAWN_MOVE; // in Spartan no e.p. rights must be set