Clean up icsAnalyzeEngine comments.
[xboard.git] / backend.c
index 66e8173..745a20b 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1489,11 +1489,7 @@ read_from_ics(isr, closure, data, count, error)
     int buf_len;
     int next_out;
     int tkind;
-#ifdef WIN32
-       /* For zippy color lines of winboard
-        * cleanup for gcc compiler */
-       int backup;
-#endif
+    int backup;
     char *p;
 
 #ifdef WIN32
@@ -1750,19 +1746,19 @@ read_from_ics(isr, closure, data, count, error)
 
            oldi = i;
            if (appData.zippyTalk || appData.zippyPlay) {
+                /* Backup address for color zippy lines */
+                backup = i;
 #if ZIPPY
        #ifdef WIN32
-               /* Backup address for color zippy lines */
-               backup = i;
                if (loggedOn == TRUE)
                        if (ZippyControl(buf, &backup) || ZippyConverse(buf, &backup) ||
                                (appData.zippyPlay && ZippyMatch(buf, &backup)));
                #else
-               if (ZippyControl(buf, &i) ||
-                   ZippyConverse(buf, &i) ||
-                   (appData.zippyPlay && ZippyMatch(buf, &i))) {
+               if (ZippyControl(buf, &backup) ||
+                   ZippyConverse(buf, &backup) ||
+                   (appData.zippyPlay && ZippyMatch(buf, &backup))) {
                    loggedOn = TRUE;
-                   continue;
+                   if (!appData.colorize) continue;
                }
        #endif
 #endif
@@ -2445,6 +2441,11 @@ read_from_ics(isr, closure, data, count, error)
                if (gameMode == IcsObserving &&
                    atoi(star_match[0]) == ics_gamenum)
                  {
+                         /* icsEngineAnalyze */
+                         if (appData.icsEngineAnalyze) {
+                            ExitAnalyzeMode();
+                                ModeHighlight();
+                         }
                      StopClocks();
                      gameMode = IcsIdle;
                      ics_gamenum = -1;
@@ -4393,6 +4394,7 @@ HandleMachineMove(message, cps)
            break;
          case AnalyzeMode:
          case AnalyzeFile:
+               break;
          /* icsEngineAnalyze */
          case IcsObserving:
                if (!appData.icsEngineAnalyze) ignore = TRUE;
@@ -7787,9 +7789,10 @@ void
 ExitAnalyzeMode()
 {
        /* icsEngineAnalyze - possible call from other functions */
-       if (appData.icsEngineAnalyze) 
+       if (appData.icsEngineAnalyze) {
            appData.icsEngineAnalyze = FALSE;
-
+               DisplayMessage("","Close ICS engine analyze...");
+       }
     if (first.analysisSupport && first.analyzing) {
       SendToProgram("exit\n", &first);
       first.analyzing = FALSE;
@@ -8919,7 +8922,18 @@ ReceiveFromProgram(isr, closure, message, count, error)
                SubtractTimeMarks(&now, &programStartTime),
                cps->which, message);
     }
-    HandleMachineMove(message, cps);
+       /* if icsEngineAnalyze is active we block all
+          whisper and kibitz output, because nobody want 
+          see this 
+        */
+       if (appData.icsEngineAnalyze) {
+               if (strstr(message, "whisper") != NULL ||
+                   strstr(message, "kibitz") != NULL || 
+                       strstr(message, "tellics") != NULL) return;
+               HandleMachineMove(message, cps);
+       } else {
+               HandleMachineMove(message, cps);
+       }
 }