X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=b269cde60498a8876f4daba0d831bf7ddf9e1b30;hb=e22090f94af45d13d5e735e3227ff4573e62654e;hp=3c21f9dec73f86411a2ff30766a6435944094767;hpb=22dd9bcd6ae74b6206a606e617286f4277eb801c;p=xboard.git diff --git a/backend.c b/backend.c index 3c21f9d..b269cde 100644 --- a/backend.c +++ b/backend.c @@ -131,9 +131,16 @@ extern int gettimeofday(struct timeval *, struct timezone *); #ifdef ENABLE_NLS # define _(s) gettext (s) # define N_(s) gettext_noop (s) +# define T_(s) gettext(s) #else -# define _(s) (s) -# define N_(s) s +# ifdef WIN32 +# define _(s) T_(s) +# define N_(s) s +# else +# define _(s) (s) +# define N_(s) s +# define T_(s) s +# endif #endif @@ -714,8 +721,8 @@ InitBackEnd1() /* [AS] Adjudication threshold */ adjudicateLossThreshold = appData.adjudicateLossThreshold; - first.which = "first"; - second.which = "second"; + first.which = _("first"); + second.which = _("second"); first.maybeThinking = second.maybeThinking = FALSE; first.pr = second.pr = NoProc; first.isr = second.isr = NULL; @@ -4568,6 +4575,10 @@ SendMoveToICS(moveType, fromX, fromY, toX, toY) /* POP Fabien */ sprintf(user_move, "o-o-o\n"); break; + case WhiteNonPromotion: + case BlackNonPromotion: + sprintf(user_move, "%c%c%c%c=\n", AAA + fromX, ONE + fromY, AAA + toX, ONE + toY); + break; case WhitePromotionQueen: case BlackPromotionQueen: case WhitePromotionRook: @@ -4796,6 +4807,8 @@ ParseOneMove(move, moveNum, moveType, fromX, fromY, toX, toY, promoChar) case BlackPromotionKnight: case WhitePromotionKing: case BlackPromotionKing: + case WhiteNonPromotion: + case BlackNonPromotion: case NormalMove: case WhiteCapturesEnPassant: case BlackCapturesEnPassant: @@ -8163,6 +8176,8 @@ ParseGameHistory(game) case BlackPromotionKnight: case WhitePromotionKing: case BlackPromotionKing: + case WhiteNonPromotion: + case BlackNonPromotion: case NormalMove: case WhiteCapturesEnPassant: case BlackCapturesEnPassant: @@ -8309,7 +8324,6 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) /* [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 */ - { int i; if(gameInfo.variant == VariantBerolina) berolina = EP_BEROLIN_A; oldEP = (signed char)board[EP_STATUS]; @@ -8318,6 +8332,16 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) if( board[toY][toX] != EmptySquare ) board[EP_STATUS] = EP_CAPTURE; + /* [HGM] In Shatranj and Courier all promotions are to Ferz */ + if((gameInfo.variant==VariantShatranj || gameInfo.variant==VariantCourier || gameInfo.variant == VariantMakruk) + && promoChar != 0) promoChar = PieceToChar(WhiteFerz); + + if (fromY == DROP_RANK) { + /* must be first */ + piece = board[toY][toX] = (ChessSquare) fromX; + } else { + int i; + if( board[fromY][fromX] == WhitePawn ) { if(fromY != toY) // [HGM] Xiangqi sideway Pawn moves should not count as 50-move breakers board[EP_STATUS] = EP_PAWN_MOVE; @@ -8349,18 +8373,8 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) ) board[CASTLING][i] = NoRights; // revoke for moved or captured piece } - } + if (fromX == toX && fromY == toY) return; - /* [HGM] In Shatranj and Courier all promotions are to Ferz */ - if((gameInfo.variant==VariantShatranj || gameInfo.variant==VariantCourier || gameInfo.variant == VariantMakruk) - && promoChar != 0) promoChar = PieceToChar(WhiteFerz); - - if (fromX == toX && fromY == toY) return; - - if (fromY == DROP_RANK) { - /* must be first */ - piece = board[toY][toX] = (ChessSquare) fromX; - } else { piece = board[fromY][fromX]; /* [HGM] remember, for Shogi promotion */ king = piece < (int) BlackPawn ? WhiteKing : BlackKing; /* [HGM] Knightmate simplify testing for castling */ if(gameInfo.variant == VariantKnightmate) @@ -9366,7 +9380,12 @@ GameEnds(result, resultDetails, whosays) gameMode = nextGameMode; ModeHighlight(); endingGame = 0; /* [HGM] crash */ - if(popupRequested) DisplayFatalError(buf, 0, 0); // [HGM] crash: this call GameEnds recursively through ExitEvent! Make it a harmless tail recursion. + if(popupRequested) { // [HGM] crash: this calls GameEnds recursively through ExitEvent! Make it a harmless tail recursion. + if(matchMode == TRUE) DisplayFatalError(buf, 0, 0); else { + matchMode = FALSE; appData.matchGames = matchGame = 0; + DisplayNote(buf); + } + } } /* Assumes program was just initialized (initString sent). @@ -9634,6 +9653,8 @@ LoadGameOneMove(readAhead) case BlackPromotionKnight: case WhitePromotionKing: case BlackPromotionKing: + case WhiteNonPromotion: + case BlackNonPromotion: case NormalMove: case WhiteKingSideCastle: case WhiteQueenSideCastle: @@ -14002,7 +14023,7 @@ DisplayMove(moveNumber) sprintf(res, " %s", PGNResult(gameInfo.result)); } else { sprintf(res, " {%s} %s", - gameInfo.resultDetails, PGNResult(gameInfo.result)); + T_(gameInfo.resultDetails), PGNResult(gameInfo.result)); } } else { res[0] = NULLCHAR;