From: Arun Persaud Date: Fri, 4 Sep 2009 05:50:28 +0000 (-0700) Subject: Merge branch 'master' into gtk X-Git-Tag: gtk-20091122~31 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=1d0d7f60da48fe87c846c32d09f13da67a636948 Merge branch 'master' into gtk Conflicts: Makefile.am backend.c configure.ac xboard.c --- 1d0d7f60da48fe87c846c32d09f13da67a636948 diff --cc Makefile.am index d9a98ef,d1e2c61..c75cddc --- a/Makefile.am +++ b/Makefile.am @@@ -1,9 -1,15 +1,15 @@@ + + if ZIPPY + ZPY = zippy.c + else + ZPY = + endif + bin_PROGRAMS = xboard - xboard_SOURCES = backend.c lists.c pgntags.c xedittags.c xhistory.c zippy.c childio.c moves.c uci.c xengineoutput.c xoptions.c gamelist.c parser.l xboard.c xgamelist.c book.c callback.c interface.c -xboard_SOURCES = backend.c lists.c pgntags.c xedittags.c xhistory.c $(ZPY) childio.c moves.c uci.c xengineoutput.c xoptions.c gamelist.c parser.l xboard.c xgamelist.c book.c ++xboard_SOURCES = backend.c lists.c pgntags.c xedittags.c xhistory.c $(ZPY) childio.c moves.c uci.c xengineoutput.c xoptions.c gamelist.c parser.l xboard.c xgamelist.c book.c callback.c interface.c -AM_CPPFLAGS=-DINFODIR='"$(infodir)"' @X_CFLAGS@ -AM_LDFLAGS= -lm @X_PRE_LIBS@ @XAW_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ +AM_CPPFLAGS=-DINFODIR='"$(infodir)"' @GTK_CFLAGS@ - AM_LDFLAGS= -lm @XAW_LIBS@ @GTK_LIBS@ - ++AM_LDFLAGS= -lm @X_PRE_LIBS@ @XAW_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ @GTK_LIBS@ info_TEXINFOS = copyright.texi xboard.texi man6_MANS = xboard.man diff --cc backend.c index 8f84481,b0d9351..83b3733 --- a/backend.c +++ b/backend.c @@@ -3851,13 -3854,13 +3854,13 @@@ ParseBoard12(string DisplayBothClocks(); else StartClocks(); - + /* Display opponents and material strengths */ if (gameInfo.variant != VariantBughouse && - gameInfo.variant != VariantCrazyhouse) { + gameInfo.variant != VariantCrazyhouse && !appData.noGUI) { if (tinyLayout || smallLayout) { if(gameInfo.variant == VariantNormal) - sprintf(str, "%s(%d) %s(%d) {%d %d}", + sprintf(str, "%s(%d) %s(%d) {%d %d}", gameInfo.white, white_stren, gameInfo.black, black_stren, basetime, increment); else @@@ -3880,12 -3883,12 +3883,11 @@@ } } - + /* Display the board */ - if (!pausing) { - + if (!pausing && !appData.noGUI) { - if (appData.premove) - if (!gotPremove || + if (!gotPremove || ((gameMode == IcsPlayingWhite) && (WhiteOnMove(currentMove))) || ((gameMode == IcsPlayingBlack) && (!WhiteOnMove(currentMove)))) ClearPremoveHighlights(); @@@ -5188,51 -5189,43 +5190,63 @@@ FinishMove(moveType, fromX, fromY, toX int fromX, fromY, toX, toY; /*char*/int promoChar; { - char *bookHit = 0; -if(appData.debugMode) fprintf(debugFP, "moveType 5 = %d, promochar = %x\n", moveType, promoChar); - if((gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) && promoChar != NULLCHAR) { - // [HGM] superchess: suppress promotions to non-available piece - int k = PieceToNumber(CharToPiece(ToUpper(promoChar))); - if(WhiteOnMove(currentMove)) { - if(!boards[currentMove][k][BOARD_WIDTH-2]) return 0; - } else { - if(!boards[currentMove][BOARD_HEIGHT-1-k][1]) return 0; + char *bookHit = 0; + + if(appData.debugMode) + fprintf(debugFP, "moveType 5 = %d, promochar = %x\n", moveType, promoChar); + + if((gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) && promoChar != NULLCHAR) + { + // [HGM] superchess: suppress promotions to non-available piece + int k = PieceToNumber(CharToPiece(ToUpper(promoChar))); + if(WhiteOnMove(currentMove)) + { + if(!boards[currentMove][k][BOARD_WIDTH-2]) + return 0; + } + else + { + if(!boards[currentMove][BOARD_HEIGHT-1-k][1]) + return 0; } } - ++ + /* [HGM] kludge to avoid having to know the exact promotion + move type in caller when we know the move is a legal promotion */ + if(moveType == NormalMove && promoChar) + moveType = PromoCharToMoveType(WhiteOnMove(currentMove), promoChar); - if(appData.debugMode) - /* [HGM] kludge to avoid having to know the exact promotion - move type in caller when we know the move is a legal promotion */ - if(moveType == NormalMove && promoChar) - moveType = PromoCharToMoveType(WhiteOnMove(currentMove), promoChar); -if(appData.debugMode) fprintf(debugFP, "moveType 1 = %d, promochar = %x\n", moveType, promoChar); - /* [HGM] convert drag-and-drop piece drops to standard form */ - if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) { - moveType = WhiteOnMove(currentMove) ? WhiteDrop : BlackDrop; - if(appData.debugMode) fprintf(debugFP, "Drop move %d, curr=%d, x=%d,y=%d, p=%d\n", ++ if(appData.debugMode) + fprintf(debugFP, "moveType 1 = %d, promochar = %x\n", moveType, promoChar); + + /* [HGM] convert drag-and-drop piece drops to standard form */ - if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) ++ if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) + { + moveType = WhiteOnMove(currentMove) ? WhiteDrop : BlackDrop; - fromX = boards[currentMove][fromY][fromX]; ++ if(appData.debugMode) ++ fprintf(debugFP, "Drop move %d, curr=%d, x=%d,y=%d, p=%d\n", + moveType, currentMove, fromX, fromY, boards[currentMove][fromY][fromX]); -// fromX = boards[currentMove][fromY][fromX]; - // holdings might not be sent yet in ICS play; we have to figure out which piece belongs here - if(fromX == 0) fromY = BOARD_HEIGHT-1 - fromY; // black holdings upside-down - fromX = fromX ? WhitePawn : BlackPawn; // first piece type in selected holdings - while(PieceToChar(fromX) == '.' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) fromX++; - fromY = DROP_RANK; - } - - /* [HGM] The following if has been moved here from - UserMoveEvent(). Because it seemed to belon here (why not allow - piece drops in training games?), and because it can only be - performed after it is known to what we promote. */ - if (gameMode == Training) { ++ // fromX = boards[currentMove][fromY][fromX]; ++ // holdings might not be sent yet in ICS play; we have to figure out which piece belongs here ++ if(fromX == 0) ++ fromY = BOARD_HEIGHT-1 - fromY; // black holdings upside-down ++ ++ fromX = fromX ? WhitePawn : BlackPawn; // first piece type in selected holdings ++ ++ while(PieceToChar(fromX) == '.' || PieceToNumber(fromX) != fromY && fromX != (int) EmptySquare) ++ fromX++; ++ + fromY = DROP_RANK; + } + + /* [HGM] The following if has been moved here from + UserMoveEvent(). Because it seemed to belon here (why not allow + piece drops in training games?), and because it can only be + performed after it is known to what we promote. */ + if (gameMode == Training) + { /* compare the move played on the board to the next move in the - * game. If they match, display the move and the opponent's response. + * game. If they match, display the move and the opponent's response. * If they don't match, display an error message. */ int saveAnimate; @@@ -7909,9 -7889,11 +7946,11 @@@ GameEnds(result, resultDetails, whosays /* display last move only if game was not loaded from file */ if ((whosays != GE_FILE) && (currentMove == forwardMostMove)) DisplayMove(currentMove - 1); - + if (forwardMostMove != 0) { - if (gameMode != PlayFromGameFile && gameMode != EditGame) { + if (gameMode != PlayFromGameFile && gameMode != EditGame + && lastSavedGame != GameCheckSum() // [HGM] save: suppress duplicates + ) { if (*appData.saveGameFile != NULLCHAR) { SaveGameToFile(appData.saveGameFile, TRUE); } else if (appData.autoSaveGames) { @@@ -8258,8 -8237,7 +8297,8 @@@ Reset(redraw, init DisplayTitle(""); DisplayMessage("", ""); HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1); - + lastSavedGame = 0; // [HGM] save: make sure next game counts as unsaved + return; } void