FILE *WriteTourneyFile P((char *results, FILE *f));
void DisplayTwoMachinesTitle P(());
static void ExcludeClick P((int index));
+void ToggleSecond P((void));
#ifdef WIN32
extern void ConsoleCreate();
/* Send . command to Crafty to collect stats */
SendToProgram(".\n", &first);
+ if(second.analyzing) SendToProgram(".\n", &second);
/* Don't send another until we get a response (this makes
us stop sending to old Crafty's which don't understand
}
Boolean
-LoadMultiPV (int x, int y, char *buf, int index, int *start, int *end)
+LoadMultiPV (int x, int y, char *buf, int index, int *start, int *end, int pane)
{
int startPV, multi, lineStart, origIndex = index;
char *p, buf2[MSG_SIZ];
+ ChessProgramState *cps = (pane ? &second : &first);
if(index < 0 || index >= strlen(buf)) return FALSE; // sanity
lastX = x; lastY = y;
do{ while(buf[index] && buf[index] != '\n') index++;
} while(buf[index] == '\n' && buf[index+1] == '\\' && buf[index+2] == ' ' && index++); // join kibitzed PV continuation line
buf[index] = 0;
- if(lineStart == 0 && gameMode == AnalyzeMode && (multi = MultiPV(&first)) >= 0) {
- int n = first.option[multi].value;
+ if(lineStart == 0 && gameMode == AnalyzeMode && (multi = MultiPV(cps)) >= 0) {
+ int n = cps->option[multi].value;
if(origIndex > 17 && origIndex < 24) { if(n>1) n--; } else if(origIndex > index - 6) n++;
snprintf(buf2, MSG_SIZ, "option MultiPV=%d\n", n);
- if(first.option[multi].value != n) SendToProgram(buf2, &first);
- first.option[multi].value = n;
+ if(cps->option[multi].value != n) SendToProgram(buf2, cps);
+ cps->option[multi].value = n;
*start = *end = 0;
return FALSE;
} else if(strstr(buf+lineStart, "exclude:") == buf+lineStart) { // exclude moves clicked
}
/* Relay move to ICS or chess engine */
+ if(second.analyzing) ToggleSecond(); // for now, we just stop second analyzing engine
if (appData.icsActive) {
if (gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack ||
gameMode == IcsExamining) {
}
void
+ToggleSecond ()
+{
+ if(second.analyzing) {
+ SendToProgram("exit\n", &second);
+ second.analyzing = FALSE;
+ } else {
+ if (second.pr == NoProc) StartChessProgram(&second);
+ InitChessProgram(&second, FALSE);
+ FeedMovesToProgram(&second, currentMove);
+
+ SendToProgram("analyze\n", &second);
+ second.analyzing = TRUE;
+ }
+}
+
+void
AnalyzeModeEvent ()
{
+ if (gameMode == AnalyzeMode) { ToggleSecond(); return; }
if (appData.noChessProgram || gameMode == AnalyzeMode)
return;
SendToProgram("exit\n", &first);
first.analyzing = FALSE;
}
+ if (second.analyzing) {
+ SendToProgram("exit\n", &second);
+ second.analyzing = FALSE;
+ }
thinkOutput[0] = NULLCHAR;
}
if (gameMode == EditGame || gameMode == AnalyzeMode ||
gameMode == Training || gameMode == PlayFromGameFile ||
gameMode == AnalyzeFile) {
+ if(target != currentMove && second.analyzing) ToggleSecond(); // for now, we just stop second analyzing engine
while (currentMove < target) {
SendMoveToProgram(currentMove++, &first);
}
}
if (gameMode == EditGame || gameMode==AnalyzeMode ||
gameMode == PlayFromGameFile || gameMode == AnalyzeFile) {
+ if(target != currentMove && second.analyzing) ToggleSecond(); // for now, we just stop second analyzing engine
while (currentMove > target) {
if(moveList[currentMove-1][1] == '@' && moveList[currentMove-1][0] == '@') {
// null move cannot be undone. Reload program with move history before it.
void EditPositionDone P((Boolean fakeRights));
Boolean GetArgValue P((char *name));
Boolean LoadPV P((int x, int y));
-Boolean LoadMultiPV P((int x, int y, char *buf, int index, int *start, int *end));
+Boolean LoadMultiPV P((int x, int y, char *buf, int index, int *start, int *end, int pane));
void UnLoadPV P(());
void MovePV P((int x, int y, int h));
int PromoScroll P((int x, int y));
static int lastForwardMostMove[2] = { -1, -1 };
static int engineState[2] = { -1, -1 };
static char lastLine[2][MSG_SIZ];
-static char header[MSG_SIZ];
+static char header[2][MSG_SIZ];
#define MAX_VAR 400
static int scores[MAX_VAR], textEnd[MAX_VAR], keys[MAX_VAR], curDepth[2], nrVariations[2];
if( clearMemo ) {
DoClearMemo(which); nrVariations[which] = 0;
- header[0] = NULLCHAR;
+ header[which][0] = NULLCHAR;
if(gameMode == AnalyzeMode) {
- if((multi = MultiPV(&first)) >= 0) {
- snprintf(header, MSG_SIZ, "\t%s viewpoint\t\tfewer / Multi-PV setting = %d / more\n",
- appData.whitePOV || appData.scoreWhite ? "white" : "mover", first.option[multi].value);
+ ChessProgramState *cps = (which ? &second : &first);
+ if((multi = MultiPV(cps)) >= 0) {
+ snprintf(header[which], MSG_SIZ, "\t%s viewpoint\t\tfewer / Multi-PV setting = %d / more\n",
+ appData.whitePOV || appData.scoreWhite ? "white" : "mover", cps->option[multi].value);
}
- snprintf(header+strlen(header), MSG_SIZ-strlen(header), "%s", exclusionHeader);
- InsertIntoMemo( which, header, 0);
+ if(!which) snprintf(header[which]+strlen(header[which]), MSG_SIZ-strlen(header[which]), "%s", exclusionHeader);
+ InsertIntoMemo( which, header[which], 0);
} else
if(appData.ponderNextMove && lastLine[which][0]) {
InsertIntoMemo( which, lastLine[which], 0 );
switch( gameMode ) {
case IcsObserving: // [HGM] ICS analyze
if(!appData.icsEngineAnalyze) return;
- case AnalyzeMode:
case AnalyzeFile:
case MachinePlaysWhite:
case MachinePlaysBlack:
mode = 0;
break;
+ case AnalyzeMode:
+ mode = second.analyzing;
+ break;
case IcsPlayingWhite:
case IcsPlayingBlack:
mode = appData.zippyPlay && opponentKibitzes; // [HGM] kibitz
scores[n] = newScore;
}
nrVariations[n] += 2;
- return offs + (gameMode == AnalyzeMode)*strlen(header);
+ return offs + (gameMode == AnalyzeMode)*strlen(header[ed->which]);
}
memo = currentPV ? IDC_EngineMemo2 : IDC_EngineMemo1;\r
index = SendDlgItemMessage( hDlg, memo, EM_CHARFROMPOS, 0, (LPARAM) &pt );\r
GetDlgItemText(hDlg, memo, buf, sizeof(buf));\r
- if(LoadMultiPV(x, y, buf, index, &start, &end)) {\r
+ if(LoadMultiPV(x, y, buf, index, &start, &end, currentPV)) {\r
SetCapture(hDlg);\r
SendMessage( outputField[currentPV][nMemo], EM_SETSEL, (WPARAM)start, (LPARAM)end );\r
highTextStart[currentPV] = start; highTextEnd[currentPV] = end;\r
XtSetArg(arg, XtNstring, &val);
XtGetValues(w, &arg, 1);
shiftKey = strcmp(params[0], "0");
- if(LoadMultiPV(x, y, val, index, &start, &end)) {
+ if(LoadMultiPV(x, y, val, index, &start, &end, currentPV)) {
XawTextSetSelection( w, start, end );
highTextStart[currentPV] = start; highTextEnd[currentPV] = end;
}