X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=e08a5f5ce5b49559e6c2e73efad3aef7260d5c0b;hb=3b417f05cba6e7b573d351790ef28cc2476fc407;hp=67992f14c90e6dbac4dfbd5bfede7427d3d00b83;hpb=eb0b8eabe5bf8d5139bc82bf79b88aded98d96c8;p=xboard.git diff --git a/xboard.c b/xboard.c index 67992f1..e08a5f5 100644 --- a/xboard.c +++ b/xboard.c @@ -1731,6 +1731,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) xpmPieceBitmap[i][(int)WhiteMarshall] = xpmPieceBitmap2[i][(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + xpmPieceBitmap[i][(int)WhiteAngel] = xpmPieceBitmap2[i][(int)WhiteFalcon]; + xpmPieceBitmap[i][(int)WhiteMarshall] = xpmPieceBitmap2[i][(int)WhiteAlfil]; + } #if !HAVE_LIBXPM // [HGM] why are thee ximMasks used at all? the ximPieceBitmaps seem to be never used! for(p=0; p<=(int)WhiteKing; p++) @@ -1747,6 +1751,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + ximMaskPm[(int)WhiteAngel] = ximMaskPm2[(int)WhiteFalcon]; + ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[(int)WhiteAlfil]; + } #endif } } else { @@ -1766,6 +1774,10 @@ void InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[i][(int)WhiteMarshall] = pieceBitmap2[i][(int)WhiteSilver]; } #endif + if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) { + pieceBitmap[i][(int)WhiteAngel] = pieceBitmap2[i][(int)WhiteFalcon]; + pieceBitmap[i][(int)WhiteMarshall] = pieceBitmap2[i][(int)WhiteAlfil]; + } } } #if HAVE_LIBXPM @@ -5815,7 +5827,7 @@ SendPositionSelection(Widget w, Atom *selection, Atom *target, * automatically call XtFree on the value returned. So have to * make a copy of it allocated with XtMalloc */ selection_tmp= XtMalloc(strlen(selected_fen_position)+16); - safeStrCpy(selection_tmp, selected_fen_position, sizeof(selection_tmp)/sizeof(selection_tmp[0]) ); + safeStrCpy(selection_tmp, selected_fen_position, strlen(selected_fen_position)+16 ); *value_return=selection_tmp; *length_return=strlen(selection_tmp); @@ -7609,7 +7621,7 @@ ExpandPathName(path) } else { safeStrCpy(buf, s+1, sizeof(buf)/sizeof(buf[0]) ); - *strchr(buf, '/') = 0; + { char *p; if(p = strchr(buf, '/')) *p = 0; } pwd = getpwnam(buf); if (!pwd) { @@ -8168,8 +8180,7 @@ DoInputCallback(closure, source, xid) /* read from stdin */ rl_callback_read_char(); - - /* redisplay the current line, check special case for login and password */ + /* redisplay the current line */ if(sending_ICS_password) { int i; char buf[MSG_SIZ]; @@ -9048,6 +9059,17 @@ DragPieceBegin(x, y) XCopyArea(xDisplay, xBoardWindow, player.saveBuf, player.blitGC, corner.x, corner.y, squareSize, squareSize, 0, 0); // [HGM] zh: unstack in stead of grab + if(gatingPiece != EmptySquare) { + /* Kludge alert: When gating we want the introduced + piece to appear on the from square. To generate an + image of it, we draw it on the board, copy the image, + and draw the original piece again. */ + ChessSquare piece = boards[currentMove][boardY][boardX]; + DrawSquare(boardY, boardX, gatingPiece, 0); + XCopyArea(xDisplay, xBoardWindow, player.saveBuf, player.blitGC, + corner.x, corner.y, squareSize, squareSize, 0, 0); + DrawSquare(boardY, boardX, piece, 0); + } damage[0][boardY][boardX] = True; } else { player.dragActive = False;