Install engines as ./exefile in XBoard
[xboard.git] / backend.c
index d1f3b04..b1d35a9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -920,6 +920,7 @@ Load (ChessProgramState *cps, int i)
        p[-1] = 0;
        appData.directory[i] = strdup(engineName);
        p[-1] = SLASH;
+       if(SLASH == '/' && p - engineName > 1) *(p -= 2) = '.'; // for XBoard use ./exeName as command after split!
     } else appData.directory[i] = ".";
     if(params[0]) {
        if(strchr(p, ' ') && !strchr(p, '"')) snprintf(buf2, MSG_SIZ, "\"%s\"", p), p = buf2; // quote if it contains spaces
@@ -6886,7 +6887,8 @@ LeftClick (ClickType clickType, int xPix, int yPix)
               || x == BOARD_RGHT+1 && y >= gameInfo.holdingsSize) )
        return;
 
-    if(gotPremove && clickType == Press) { // user starts something after premove has been entered: abort premove as side effect
+    if(gotPremove && x == premoveFromX && y == premoveFromY && clickType == Release) {
+       // could be static click on premove from-square: abort premove
        gotPremove = 0;
        ClearPremoveHighlights();
     }
@@ -8362,7 +8364,7 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats.
 
     /*
      * If chess program startup fails, exit with an error message.
-     * Attempts to recover here are futile.
+     * Attempts to recover here are futile. [HGM] Well, we try anyway
      */
     if ((StrStr(message, "unknown host") != NULL)
        || (StrStr(message, "No remote directory") != NULL)
@@ -8376,7 +8378,14 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats.
                _(cps->which), cps->program, cps->host, message);
        RemoveInputSource(cps->isr);
        if(appData.icsActive) DisplayFatalError(buf1, 0, 1); else {
-           if(cps == &first) appData.noChessProgram = TRUE;
+           if(cps == &first) {
+               appData.noChessProgram = TRUE;
+               gameMode = MachinePlaysBlack; ModeHighlight(); // kludge to unmark Machine Black menu
+               gameMode = BeginningOfGame; ModeHighlight();
+               SetNCPMode();
+           }
+           if(GetDelayedEvent()) CancelDelayedEvent(), ThawUI(); // [HGM] cancel remaining loading effort scheduled after feature timeout
+           DisplayMessage("", ""); // erase waiting message
            DisplayError(buf1, 0);
        }
        return;
@@ -13685,6 +13694,7 @@ EditPositionEvent ()
     currentMove = forwardMostMove = backwardMostMove = 0;
     HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);
     DisplayMove(-1);
+    if(!appData.pieceMenu) DisplayMessage("Click clock to clear board", "");
 }
 
 void