X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=20e5efce5011ebb0cd9e56bd53101dc5a974471d;hb=2fd5b9307494fd53d7d052025daa1eec580cbc9f;hp=0a8b6823fc63cc2535ba7764ebbdd0ab82cd3f17;hpb=19ba39ea3fba5ff50a6624575b262db203ada9d4;p=xboard.git diff --git a/backend.c b/backend.c index 0a8b682..20e5efc 100644 --- a/backend.c +++ b/backend.c @@ -152,7 +152,6 @@ void read_from_player P((InputSourceRef isr, VOIDSTAR closure, char *buf, int count, int error)); void read_from_ics P((InputSourceRef isr, VOIDSTAR closure, char *buf, int count, int error)); -void ics_printf P((char *format, ...)); void SendToICS P((char *s)); void SendToICSDelayed P((char *s, long msdelay)); void SendMoveToICS P((ChessMove moveType, int fromX, int fromY, int toX, int toY, char promoChar)); @@ -1253,7 +1252,7 @@ GetTimeQuota (int movenr, int lastUsed, char *tcString) long time, increment; char *s = tcString; - if(!*s) return 0; // empty TC string means we ran out of the last sudden-death version + if(!s || !*s) return 0; // empty TC string means we ran out of the last sudden-death version do { if(moves) NextSessionFromString(&s, &moves, &time, &increment, &incType); nextSession = s; suddenDeath = moves == 0 && increment == 0; @@ -6193,12 +6192,12 @@ UpdateExcludeHeader (int fromY, int fromX, int toY, int toX, char promoChar, cha } static int -ExcludeOneMove (int fromY, int fromX, int toY, int toX, signed char promoChar, char state) +ExcludeOneMove (int fromY, int fromX, int toY, int toX, char promoChar, char state) { // include or exclude the given move, as specified by state ('+' or '-'), or toggle char buf[MSG_SIZ]; int j, k; ChessMove moveType; - if(promoChar == -1) { // kludge to indicate best move + if((signed char)promoChar == -1) { // kludge to indicate best move if(!ParseOneMove(lastPV[0], currentMove, &moveType, &fromX, &fromY, &toX, &toY, &promoChar)) // get current best move from last PV return 1; // if unparsable, abort } @@ -7202,9 +7201,9 @@ LeftClick (ClickType clickType, int xPix, int yPix) if(!sweepSelecting) { toX = x; toY = y; - saveAnimate = appData.animate; } else sweepSelecting = 0; // this must be the up-click corresponding to the down-click that started the sweep + saveAnimate = appData.animate; if (clickType == Press) { if(gameMode == EditPosition && boards[currentMove][fromY][fromX] == EmptySquare) { // must be Edit Position mode with empty-square selected @@ -13933,11 +13932,11 @@ EditPositionDone (Boolean fakeRights) boards[0][EP_STATUS] = EP_NONE; boards[0][CASTLING][2] = boards[0][CASTLING][5] = BOARD_WIDTH>>1; if(boards[0][0][BOARD_WIDTH>>1] == king) { - boards[0][CASTLING][1] = boards[0][0][BOARD_LEFT] == WhiteRook ? 0 : NoRights; + boards[0][CASTLING][1] = boards[0][0][BOARD_LEFT] == WhiteRook ? BOARD_LEFT : NoRights; boards[0][CASTLING][0] = boards[0][0][BOARD_RGHT-1] == WhiteRook ? BOARD_RGHT-1 : NoRights; } else boards[0][CASTLING][2] = NoRights; if(boards[0][BOARD_HEIGHT-1][BOARD_WIDTH>>1] == WHITE_TO_BLACK king) { - boards[0][CASTLING][4] = boards[0][BOARD_HEIGHT-1][BOARD_LEFT] == BlackRook ? 0 : NoRights; + boards[0][CASTLING][4] = boards[0][BOARD_HEIGHT-1][BOARD_LEFT] == BlackRook ? BOARD_LEFT : NoRights; boards[0][CASTLING][3] = boards[0][BOARD_HEIGHT-1][BOARD_RGHT-1] == BlackRook ? BOARD_RGHT-1 : NoRights; } else boards[0][CASTLING][5] = NoRights; } @@ -13955,6 +13954,7 @@ EditPositionDone (Boolean fakeRights) fprintf(debugFP, "EditPosDone\n"); } DisplayTitle(""); + DisplayMessage("", ""); timeRemaining[0][forwardMostMove] = whiteTimeRemaining; timeRemaining[1][forwardMostMove] = blackTimeRemaining; gameMode = EditGame; @@ -16871,7 +16871,7 @@ ParseFEN (Board board, int *blackPlaysFirst, char *fen) (gameInfo.variant == VariantFischeRandom || gameInfo.variant == VariantCapaRandom) && ( *p >= 'a' && *p < 'a' + gameInfo.boardWidth) || ( *p >= 'A' && *p < 'A' + gameInfo.boardWidth) ) { - char c = *p++; int whiteKingFile=NoRights, blackKingFile=NoRights; + int c = *p++, whiteKingFile=NoRights, blackKingFile=NoRights; for(i=BOARD_LEFT; i