X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=29052a4c5b916edf786ed6a00607f9cc6d3d1225;hb=18cac83a5bade9078bbdf0c1141f521ec4a818de;hp=8c795cda8aec91e2a19f41cedadef11ed7cbf679;hpb=f54f775f8c1d291c3de02704181182a50fa5b413;p=xboard.git diff --git a/backend.c b/backend.c index 8c795cd..29052a4 100644 --- a/backend.c +++ b/backend.c @@ -1489,14 +1489,9 @@ 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 if (appData.debugMode) { if (!error) { fprintf(debugFP, " 0) { /* If last read ended with a partial line that we couldn't parse, @@ -1750,19 +1744,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))); + (appData.zippyPlay && ZippyMatch(buf, &backup))); #else if (ZippyControl(buf, &i) || ZippyConverse(buf, &i) || (appData.zippyPlay && ZippyMatch(buf, &i))) { loggedOn = TRUE; - continue; + if (!appData.colorize) continue; } #endif #endif @@ -2445,6 +2439,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; @@ -2620,8 +2619,8 @@ ParseBoard12(string) char *string; { GameMode newGameMode; - int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0; - int j, k, n, moveNum, white_stren, black_stren, white_time, black_time; + int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0, i; + int j, k, n, moveNum, white_stren, black_stren, white_time, black_time, takeback; int double_push, castle_ws, castle_wl, castle_bs, castle_bl, irrev_count; char to_play, board_chars[72]; char move_str[500], str[500], elapsed_time[500]; @@ -2733,7 +2732,7 @@ ParseBoard12(string) /* Forget the old game and get the history (if any) of the new one */ if (gameMode != BeginningOfGame) { - Reset(FALSE, TRUE); + Reset(FALSE, TRUE); } newGame = TRUE; if (appData.autoRaiseBoard) BoardToTop(); @@ -2855,6 +2854,16 @@ ParseBoard12(string) /* Update currentMove and known move number limits */ newMove = newGame || moveNum > forwardMostMove; + + /* If we found takebacks during icsEngineAnalyze + try send to engine */ + if (!newGame && appData.icsEngineAnalyze && moveNum < forwardMostMove) { + takeback = forwardMostMove - moveNum; + for (i = 0; i < takeback; i++) { + if (appData.debugMode) fprintf(debugFP, "take back move\n"); + SendToProgram("undo\n", &first); + } + } if (newGame) { forwardMostMove = backwardMostMove = currentMove = moveNum; if (gameMode == IcsExamining && moveNum == 0) { @@ -4383,6 +4392,7 @@ HandleMachineMove(message, cps) break; case AnalyzeMode: case AnalyzeFile: + break; /* icsEngineAnalyze */ case IcsObserving: if (!appData.icsEngineAnalyze) ignore = TRUE; @@ -5334,8 +5344,8 @@ ResurrectChessProgram() timeRemaining[1][currentMove] = blackTimeRemaining; } - if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile) && - first.analysisSupport) { + if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile || + appData.icsEngineAnalyze) && first.analysisSupport) { SendToProgram("analyze\n", &first); first.analyzing = TRUE; } @@ -7776,9 +7786,11 @@ EditPositionEvent() void ExitAnalyzeMode() { - /* icsEngineAnalyze - possible call of other functions */ - if (appData.icsEngineAnalyze) appData.icsEngineAnalyze = FALSE; - + /* icsEngineAnalyze - possible call from other functions */ + if (appData.icsEngineAnalyze) { + appData.icsEngineAnalyze = FALSE; + DisplayMessage("","Close ICS engine analyze..."); + } if (first.analysisSupport && first.analyzing) { SendToProgram("exit\n", &first); first.analyzing = FALSE; @@ -8908,7 +8920,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); + } }