From: Arun Persaud Date: Fri, 15 Feb 2013 01:29:51 +0000 (-0800) Subject: Merge branch 'master' into v4.7.x X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=123b5b814cbc71aa6575fcea6c92131b47a237e7;hp=15a3ab112c17105b792f756125f91ec18fe38d36;p=xboard.git Merge branch 'master' into v4.7.x --- diff --git a/Makefile.am b/Makefile.am index 4396a55..7e5363b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -142,6 +142,15 @@ dist_shogi_DATA = shogi/WhiteGold.svg shogi/WhiteCrownedBishop.svg\ shogi/WhiteRook.svg shogi/WhiteCrownedRook.svg\ shogi/WhiteAdvisor.svg shogi/WhiteGoldSilver.svg +xiangqidir = $(datadir)/games/xboard/themes/xiangqi +dist_xiangqi_DATA = themes/xiangqi/BlackAdvisor.svg themes/xiangqi/WhiteAdvisor.svg \ + themes/xiangqi/BlackCanon.svg themes/xiangqi/WhiteCanon.svg \ + themes/xiangqi/BlackElephant.svg themes/xiangqi/WhiteElephant.svg \ + themes/xiangqi/BlackKnight.svg themes/xiangqi/WhiteKnight.svg \ + themes/xiangqi/BlackGold.svg themes/xiangqi/WhiteGold.svg \ + themes/xiangqi/BlackPawn.svg themes/xiangqi/WhitePawn.svg \ + themes/xiangqi/BlackRook.svg themes/xiangqi/WhiteRook.svg + ### directory and files for pixmaps pixmapsdir = $(datadir)/games/xboard/pixmaps/textures diff --git a/backend.c b/backend.c index e13bd13..f61c15c 100644 --- a/backend.c +++ b/backend.c @@ -464,7 +464,7 @@ long timeControl_2; /* [AS] Allow separate time controls */ char *fullTimeControlString = NULL, *nextSession, *whiteTC, *blackTC, activePartner; /* [HGM] secondary TC: merge of MPS, TC and inc */ long timeRemaining[2][MAX_MOVES]; int matchGame = 0, nextGame = 0, roundNr = 0; -Boolean waitingForGame = FALSE; +Boolean waitingForGame = FALSE, startingEngine = FALSE; TimeMark programStartTime, pauseStart; char ics_handle[MSG_SIZ]; int have_set_title = 0; @@ -9480,6 +9480,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY >= BOARD_HEIGHT>>1) + && (oldEP == toX || oldEP == EP_UNKNOWN || appData.testLegality) && (toX != fromX) && gameInfo.variant != VariantXiangqi && gameInfo.variant != VariantBerolina @@ -9540,6 +9541,7 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board) board[toY][toX] = (ChessSquare) (PROMOTED board[toY][toX]); board[fromY][fromX] = EmptySquare; } else if ((fromY < BOARD_HEIGHT>>1) + && (oldEP == toX || oldEP == EP_UNKNOWN || appData.testLegality) && (toX != fromX) && gameInfo.variant != VariantXiangqi && gameInfo.variant != VariantBerolina @@ -10044,7 +10046,7 @@ void TwoMachinesEventIfReady P((void)) { static int curMess = 0; - if (first.lastPing != first.lastPong || !first.initDone) { + if (first.lastPing != first.lastPong) { if(curMess != 1) DisplayMessage("", _("Waiting for first chess program")); curMess = 1; ScheduleDelayedEvent(TwoMachinesEventIfReady, 10); // [HGM] fast: lowered from 1000 return; @@ -10055,7 +10057,6 @@ TwoMachinesEventIfReady P((void)) return; } DisplayMessage("", ""); curMess = 0; - ThawUI(); TwoMachinesEvent(); } @@ -10897,7 +10898,7 @@ GameEnds (ChessMove result, char *resultDetails, int whosays) second.pr = NoProc; } - if (matchMode && (gameMode == TwoMachinesPlay || waitingForGame && exiting)) { + if (matchMode && (gameMode == TwoMachinesPlay || (waitingForGame || startingEngine) && exiting)) { char resChar = '='; switch (result) { case WhiteWins: @@ -10922,7 +10923,7 @@ GameEnds (ChessMove result, char *resultDetails, int whosays) break; } - if(waitingForGame) resChar = ' '; // quit while waiting for round sync: unreserve already reserved game + if(exiting) resChar = ' '; // quit while waiting for round sync: unreserve already reserved game if(appData.tourneyFile[0]){ // [HGM] we are in a tourney; update tourney file with game result if(appData.afterGame && appData.afterGame[0]) RunCommand(appData.afterGame); ReserveGame(nextGame, resChar); // sets nextGame @@ -11022,7 +11023,7 @@ ResurrectChessProgram () if (appData.noChessProgram) return 1; if(matchMode /*&& appData.tourneyFile[0]*/) { // [HGM] tourney: make sure we get features after engine replacement. (Should we always do this?) - if(WaitForEngine(&first, TwoMachinesEventIfReady)) { doInit = 1; return 0; } // request to do init on next visit + if(WaitForEngine(&first, TwoMachinesEventIfReady)) { doInit = 1; return 0; } // request to do init on next visit, because we started engine if(!doInit) return 1; // this replaces testing first.pr != NoProc, which is true when we get here, but first time no reason to abort doInit = 0; // we fell through (first time after starting the engine); make sure it doesn't happen again } else { @@ -13932,9 +13933,10 @@ WaitForEngine (ChessProgramState *cps, DelayedEventCallback retry) StartChessProgram(cps); if (cps->protocolVersion == 1) { retry(); + ScheduleDelayedEvent(retry, 1); // Do this also through timeout to avoid recursive calling of 'retry' } else { /* kludge: allow timeout for initial "feature" command */ - FreezeUI(); + if(retry != TwoMachinesEventIfReady) FreezeUI(); snprintf(buf, MSG_SIZ, _("Starting %s chess program"), _(cps->which)); DisplayMessage("", buf); ScheduleDelayedEvent(retry, FEATURE_TIMEOUT); @@ -13987,16 +13989,19 @@ TwoMachinesEvent P((void)) // forwardMostMove = currentMove; TruncateGame(); // [HGM] vari: MachineWhite and MachineBlack do this... + startingEngine = TRUE; if(!ResurrectChessProgram()) return; /* in case first program isn't running (unbalances its ping due to InitChessProgram!) */ - if(WaitForEngine(&second, TwoMachinesEventIfReady)) return; // (if needed:) started up second engine, so wait for features + if(!first.initDone && GetDelayedEvent() == TwoMachinesEventIfReady) return; // [HGM] engine #1 still waiting for feature timeout if(first.lastPing != first.lastPong) { // [HGM] wait till we are sure first engine has set up position ScheduleDelayedEvent(TwoMachinesEventIfReady, 10); return; } + if(WaitForEngine(&second, TwoMachinesEventIfReady)) return; // (if needed:) started up second engine, so wait for features if(second.protocolVersion >= 2 && !strstr(second.variants, VariantName(gameInfo.variant))) { + startingEngine = FALSE; DisplayError("second engine does not play this", 0); return; } @@ -14030,7 +14035,7 @@ TwoMachinesEvent P((void)) } gameMode = TwoMachinesPlay; - pausing = FALSE; + pausing = startingEngine = FALSE; ModeHighlight(); // [HGM] logo: this triggers display update of logos SetGameInfo(); DisplayTwoMachinesTitle(); diff --git a/configure.ac b/configure.ac index 218cce7..bb39cd4 100644 --- a/configure.ac +++ b/configure.ac @@ -119,8 +119,12 @@ AC_TRY_COMPILE([],[], AC_MSG_RESULT(no) CFLAGS="$SAVE_CFLAGS") -dnl | check for cairo and librsvg +dnl | check for pkg-config +AC_CHECK_PROGS([PKGCONFIG], [pkg-config], pkgconfig_not_found) +AS_IF( [test "x$PKGCONFIG" = xpkgconfig_not_found], + AC_MSG_ERROR([cannot find pkg-config! Please install it.])) +dnl | check for cairo and librsvg PKG_CHECK_MODULES([CAIRO], [ cairo >= 1.2.0 librsvg-2.0 >= 2.14.0 ]) AC_SUBST(CAIRO_CFLAGS) AC_SUBST(CAIRO_LIBS) diff --git a/draw.c b/draw.c index 53156f0..45aaf01 100644 --- a/draw.c +++ b/draw.c @@ -627,7 +627,7 @@ BlankSquare (cairo_surface_t *dest, int x, int y, int color, ChessSquare piece, static void pngDrawPiece (cairo_surface_t *dest, ChessSquare piece, int square_color, int x, int y) { - int kind, p = piece; + int kind; cairo_t *cr; if ((int)piece < (int) BlackPawn) { @@ -636,7 +636,7 @@ pngDrawPiece (cairo_surface_t *dest, ChessSquare piece, int square_color, int x, kind = 1; piece -= BlackPawn; } - if(appData.upsideDown && flipView) { p += p < BlackPawn ? BlackPawn : -BlackPawn; }// swap white and black pieces + if(appData.upsideDown && flipView) kind = 1 - kind; // swap white and black pieces BlankSquare(dest, x, y, square_color, piece, 1); // erase previous contents with background cr = cairo_create (dest); cairo_set_source_surface (cr, pngPieceBitmaps[kind][piece], x, y); diff --git a/themes/xiangqi/.DS_Store b/themes/xiangqi/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/themes/xiangqi/.DS_Store differ diff --git a/themes/xiangqi/BlackAdvisor.svg b/themes/xiangqi/BlackAdvisor.svg new file mode 100644 index 0000000..7ad4814 --- /dev/null +++ b/themes/xiangqi/BlackAdvisor.svg @@ -0,0 +1,86 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackCanon.svg b/themes/xiangqi/BlackCanon.svg new file mode 100644 index 0000000..f056bdb --- /dev/null +++ b/themes/xiangqi/BlackCanon.svg @@ -0,0 +1,81 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackElephant.svg b/themes/xiangqi/BlackElephant.svg new file mode 100644 index 0000000..e94d1de --- /dev/null +++ b/themes/xiangqi/BlackElephant.svg @@ -0,0 +1,80 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackGold.svg b/themes/xiangqi/BlackGold.svg new file mode 100644 index 0000000..148617d --- /dev/null +++ b/themes/xiangqi/BlackGold.svg @@ -0,0 +1,80 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackKnight.svg b/themes/xiangqi/BlackKnight.svg new file mode 100644 index 0000000..7236d38 --- /dev/null +++ b/themes/xiangqi/BlackKnight.svg @@ -0,0 +1,81 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackPawn.svg b/themes/xiangqi/BlackPawn.svg new file mode 100644 index 0000000..87b5191 --- /dev/null +++ b/themes/xiangqi/BlackPawn.svg @@ -0,0 +1,83 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/BlackRook.svg b/themes/xiangqi/BlackRook.svg new file mode 100644 index 0000000..4790598 --- /dev/null +++ b/themes/xiangqi/BlackRook.svg @@ -0,0 +1,80 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteAdvisor.svg b/themes/xiangqi/WhiteAdvisor.svg new file mode 100644 index 0000000..a12769d --- /dev/null +++ b/themes/xiangqi/WhiteAdvisor.svg @@ -0,0 +1,90 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteCanon.svg b/themes/xiangqi/WhiteCanon.svg new file mode 100644 index 0000000..4d2321a --- /dev/null +++ b/themes/xiangqi/WhiteCanon.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteElephant.svg b/themes/xiangqi/WhiteElephant.svg new file mode 100644 index 0000000..9f8559f --- /dev/null +++ b/themes/xiangqi/WhiteElephant.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteGold.svg b/themes/xiangqi/WhiteGold.svg new file mode 100644 index 0000000..bcd1840 --- /dev/null +++ b/themes/xiangqi/WhiteGold.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteKnight.svg b/themes/xiangqi/WhiteKnight.svg new file mode 100644 index 0000000..81e4df9 --- /dev/null +++ b/themes/xiangqi/WhiteKnight.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhitePawn.svg b/themes/xiangqi/WhitePawn.svg new file mode 100644 index 0000000..f229f89 --- /dev/null +++ b/themes/xiangqi/WhitePawn.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/themes/xiangqi/WhiteRook.svg b/themes/xiangqi/WhiteRook.svg new file mode 100644 index 0000000..7f98556 --- /dev/null +++ b/themes/xiangqi/WhiteRook.svg @@ -0,0 +1,86 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/winboard/winboard.c b/winboard/winboard.c index 1359d20..1c41752 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -4258,6 +4258,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } shiftKey = GetKeyState(VK_SHIFT) < 0; // [HGM] remember last shift status + controlKey = GetKeyState(VK_CONTROL) < 0; // [HGM] remember last shift status switch (message) { case WM_LBUTTONDOWN: