bugfix and enhancement in autoKibitz mode
[xboard.git] / xengineoutput.c
index 0ff63c6..5bd07a8 100644 (file)
@@ -954,13 +954,22 @@ EngineOutputProc(w, event, prms, nprms)
 }\r
 \r
 // [HGM] kibitz: write kibitz line; split window for it if necessary\r
-void OutputKibitz(char *text)\r
+void OutputKibitz(int window, char *text)\r
 {\r
        if(!EngineOutputIsUp()) return;\r
-       if(!opponentKibitzes) DoClearMemo(1);\r
-       opponentKibitzes = TRUE; // thas causes split window DisplayMode in ICS modes.\r
+       if(!opponentKibitzes) { // on first kibitz of game, clear memos\r
+           DoClearMemo(1);\r
+           if(gameMode == IcsObserving) DoClearMemo(0);\r
+       }\r
+       opponentKibitzes = TRUE; // this causes split window DisplayMode in ICS modes.\r
        VerifyDisplayMode();\r
-       DoSetWindowText(1, nLabel, gameMode == IcsPlayingWhite ? gameInfo.black : gameInfo.white); // opponent name\r
-       SetIcon( 1, nColorIcon,  gameMode == IcsPlayingWhite ? nColorBlack : nColorWhite);\r
-       InsertIntoMemo(1, text);\r
+       if(gameMode == IcsObserving) {\r
+           DoSetWindowText(0, nLabel, gameInfo.white);\r
+           SetIcon( 0, nColorIcon,  nColorWhite);\r
+           SetIcon( 0, nStateIcon,  nClear);\r
+       }\r
+       DoSetWindowText(1, nLabel, gameMode == IcsPlayingBlack ? gameInfo.white : gameInfo.black); // opponent name\r
+       SetIcon( 1, nColorIcon,  gameMode == IcsPlayingBlack ? nColorWhite : nColorBlack);\r
+       SetIcon( 1, nStateIcon,  nClear);\r
+       InsertIntoMemo(window-1, text);\r
 }\r