X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=fa467736c64596e6d128ca8a39726f08d1533472;hb=b12ca738583ee21b1533377b3424baba188ba2e0;hp=a2c554f3956e58bea7943a35cac63839dd1e1290;hpb=272e35c7f6874eae7f6f5487ad427a57212b9eca;p=xboard.git diff --git a/backend.c b/backend.c index a2c554f..fa46773 100644 --- a/backend.c +++ b/backend.c @@ -5315,22 +5315,41 @@ fprintf(debugFP,"parsePV: %d %c%c%c%c yy='%s'\nPV = '%s'\n", valid, fromX+AAA, f DrawPosition(TRUE, boards[currentMove]); } +int +MultiPV(ChessProgramState *cps) +{ // check if engine supports MultiPV, and if so, return the nmber of the option that sets it + int i; + for(i=0; inrOptions; i++) + if(!strcmp(cps->option[i].name, "MultiPV") && cps->option[i].type == Spin) + return i; + return -1; +} + Boolean LoadMultiPV(int x, int y, char *buf, int index, int *start, int *end) { - int startPV; - char *p; + int startPV, multi, lineStart, origIndex = index; + char *p, buf2[MSG_SIZ]; if(index < 0 || index >= strlen(buf)) return FALSE; // sanity lastX = x; lastY = y; while(index > 0 && buf[index-1] != '\n') index--; // beginning of line - startPV = index; + lineStart = startPV = index; while(buf[index] != '\n') if(buf[index++] == '\t') startPV = index; if(index == startPV && (p = StrCaseStr(buf+index, "PV="))) startPV = p - buf + 3; index = startPV; 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(origIndex < 10) { 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; + *start = *end = 0; + return TRUE; + } ParsePV(buf+startPV, FALSE, !shiftKey); *start = startPV; *end = index-1; return TRUE;