X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=734cf407d07818ac4327a4bb8c3fafe55de6f001;hb=1161f02260cfbb6a22a6d9de91bb31e27f16cc88;hp=5a1780ddc0a9d86d16ac21a1c2507b0b8f0d7726;hpb=40c740ae01e3c9694449134e68b7a7bd077fb172;p=xboard.git diff --git a/backend.c b/backend.c index 5a1780d..734cf40 100644 --- a/backend.c +++ b/backend.c @@ -1743,6 +1743,11 @@ InitBackEnd3 P((void)) CopyBoard(filePosition, boards[0]); CopyBoard(initialPosition, boards[0]); } + } else if(*appData.fen != NULLCHAR) { + if(ParseFEN(filePosition, &blackPlaysFirst, appData.fen, TRUE) && !blackPlaysFirst) { + startedFromPositionFile = TRUE; + Reset(TRUE, TRUE); + } } if (initialMode == AnalyzeMode) { if (appData.noChessProgram) { @@ -6454,6 +6459,7 @@ InitPosition (int redraw) initialRights[i] = filePosition[CASTLING][i]; startedFromSetupPosition = TRUE; } + if(*appData.men) LoadPieceDesc(appData.men); CopyBoard(boards[0], initialPosition); @@ -7525,11 +7531,13 @@ LeftClick (ClickType clickType, int xPix, int yPix) { int x, y; Boolean saveAnimate; - static int second = 0, promotionChoice = 0, clearFlag = 0, sweepSelecting = 0; + static int second = 0, promotionChoice = 0, clearFlag = 0, sweepSelecting = 0, flashing = 0, saveFlash; char promoChoice = NULLCHAR; ChessSquare piece; static TimeMark lastClickTime, prevClickTime; + if(flashing) return; + x = EventToSquare(xPix, BOARD_WIDTH); y = EventToSquare(yPix, BOARD_HEIGHT); if (!flipView && y >= 0) { @@ -7788,6 +7796,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) if(gameInfo.variant != VariantChuChess && PieceToChar(CHUPROMOTED(piece)) == '+') promoSweep = CHUPROMOTED(piece); selectFlag = 0; lastX = xPix; lastY = yPix; ReportClick("put", x, y); // extra put to prompt engine for 'choice' command + saveFlash = appData.flashCount; appData.flashCount = 0; Sweep(0); // Pawn that is going to promote: preview promotion piece sweepSelecting = 1; DisplayMessage("", _("Pull pawn backwards to under-promote")); @@ -7804,7 +7813,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) MarkTargetSquares(1); } else if(sweepSelecting) { // this must be the up-click corresponding to the down-click that started the sweep sweepSelecting = 0; appData.animate = FALSE; // do not animate, a selected piece already on to-square - *promoRestrict = 0; + *promoRestrict = 0; appData.flashCount = saveFlash; if (appData.animate || appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); } else { @@ -7898,6 +7907,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) PromotionPopUp(promoChoice); } else { int oldMove = currentMove; + flashing = 1; // prevent recursive calling (by release of to-click) while flashing piece UserMoveEvent(fromX, fromY, toX, toY, promoChoice); if (!appData.highlightLastMove || gotPremove) ClearHighlights(); if (gotPremove) SetPremoveHighlights(fromX, fromY, toX, toY); @@ -7905,6 +7915,7 @@ LeftClick (ClickType clickType, int xPix, int yPix) Explode(boards[currentMove-1], fromX, fromY, toX, toY)) DrawPosition(TRUE, boards[currentMove]); fromX = fromY = -1; + flashing = 0; } appData.animate = saveAnimate; if (appData.animate || appData.animateDragging) { @@ -12092,21 +12103,17 @@ AutoPlayOneMove () SetHighlights(-1, -1, toX, toY); } } else { - int viaX = moveList[currentMove][5] - AAA; - int viaY = moveList[currentMove][6] - ONE; fromX = moveList[currentMove][0] - AAA; fromY = moveList[currentMove][1] - ONE; HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove); /* [AS] */ if(moveList[currentMove][4] == ';') { // multi-leg - ChessSquare piece = boards[currentMove][viaY][viaX]; - AnimateMove(boards[currentMove], fromX, fromY, viaX, viaY); - boards[currentMove][viaY][viaX] = boards[currentMove][fromY][fromX]; - AnimateMove(boards[currentMove], fromX=viaX, fromY=viaY, toX, toY); - boards[currentMove][viaY][viaX] = piece; - } else + killX = moveList[currentMove][5] - AAA; + killY = moveList[currentMove][6] - ONE; + } AnimateMove(boards[currentMove], fromX, fromY, toX, toY); + killX = killY = -1; if (appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); @@ -12927,7 +12934,7 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) char buf[MSG_SIZ]; int gn = gameNumber; ListGame *lg = NULL; - int numPGNTags = 0; + int numPGNTags = 0, i; int err, pos = -1; GameMode oldGameMode; VariantClass v, oldVariant = gameInfo.variant; /* [HGM] PGNvariant */ @@ -13116,6 +13123,8 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList) if (appData.debugMode) fprintf(debugFP, "Parsed game start '%s' (%d)\n", yy_text, (int) cm); + for(i=0; i