Shuffle prototypes to correct header, or add them there
[xboard.git] / backend.c
index 5613773..a8e342d 100644 (file)
--- 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));
@@ -6563,10 +6562,9 @@ void
 UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar)
 {
     ChessMove moveType;
-    ChessSquare pdown, pup;
+    ChessSquare pup;
     int ff=fromX, rf=fromY, ft=toX, rt=toY;
 
-
     /* Check if the user is playing in turn.  This is complicated because we
        let the user "pick up" a piece before it is his turn.  So the piece he
        tried to pick up may have been captured by the time he puts it down!
@@ -6702,7 +6700,6 @@ UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar)
     }
 
     if(toX < 0 || toY < 0) return;
-    pdown = boards[currentMove][fromY][fromX];
     pup = boards[currentMove][toY][toX];
 
     /* [HGM] If move started in holdings, it means a drop. Convert to standard form */
@@ -7204,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
@@ -11563,7 +11560,7 @@ QuickCompare (Board board, int *minCounts, int *maxCounts)
 int
 QuickScan (Board board, Move *move)
 {   // reconstruct game,and compare all positions in it
-    int cnt=0, stretch=0, total = MakePieceList(board, counts), delayedKing = -1;
+    int cnt=0, stretch=0, total = MakePieceList(board, counts);
     do {
        int piece = move->piece;
        int to = move->to, from = pieceList[piece];
@@ -11610,7 +11607,7 @@ QuickScan (Board board, Move *move)
            if(stretch++ == 0) for(i=0; i<EmptySquare; i++) lastCounts[i] = counts[i]; // remember actual material
        } else stretch = 0;
        if(stretch && (appData.searchMode == 1 || stretch >= appData.stretch)) return cnt + 1 - stretch;
-       move++; delayedKing = -1;
+       move++;
     } while(1);
 }
 
@@ -12545,7 +12542,6 @@ int
 SaveGamePGN (FILE *f)
 {
     int i, offset, linelen, newblock;
-    time_t tm;
 //    char *movetext;
     char numtext[32];
     int movelen, numlen, blank;
@@ -12553,8 +12549,6 @@ SaveGamePGN (FILE *f)
 
     offset = backwardMostMove & (~1L); /* output move numbers start at 1 */
 
-    tm = time((time_t *) NULL);
-
     PrintPGNTags(f, &gameInfo);
 
     if(appData.numberTag && matchMode) fprintf(f, "[Number \"%d\"]\n", nextGame+1); // [HGM] number tag
@@ -13607,11 +13601,6 @@ TwoMachinesEvent P((void))
 
     if (appData.noChessProgram) return;
 
-    if(second.protocolVersion >= 2 && !strstr(second.variants, VariantName(gameInfo.variant))) {
-       DisplayError("second engine does not play this", 0);
-       return;
-    }
-
     switch (gameMode) {
       case TwoMachinesPlay:
        return;
@@ -13650,6 +13639,12 @@ TwoMachinesEvent P((void))
       ScheduleDelayedEvent(TwoMachinesEventIfReady, 10);
       return;
     }
+
+    if(second.protocolVersion >= 2 && !strstr(second.variants, VariantName(gameInfo.variant))) {
+       DisplayError("second engine does not play this", 0);
+       return;
+    }
+
     if(!stalling) {
       InitChessProgram(&second, FALSE); // unbalances ping of second engine
       SendToProgram("force\n", &second);