X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=engineoutput.c;h=0bfd8b5923250a7063524b9ad9088b64f631d604;hb=c239df0067fc40c49d83a187ae45cd52573a8459;hp=c0f915f7bb88f7b9ab7220375d91eb5e6c33f155;hpb=c3e8fae6dad454bdef9887925f541ba466592471;p=xboard.git diff --git a/engineoutput.c b/engineoutput.c index c0f915f..0bfd8b5 100644 --- a/engineoutput.c +++ b/engineoutput.c @@ -231,7 +231,7 @@ SetProgramStats (FrontEndProgramStats * stats) // now directly called by back-en header[which][0] = NULLCHAR; if(gameMode == AnalyzeMode) { ChessProgramState *cps = (which ? &second : &first); - char exclu = cps->excludeMoves ? exclusionHeader : ""; + char *exclu = cps->excludeMoves ? exclusionHeader : ""; 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); @@ -402,6 +402,14 @@ SetEngineColorIcon (int which) // [HGM] multivar: sort Thinking Output within one depth on score static int +MateFlip (int n) +{ // map mate-score to monotonous scale, so sorting compares them correctly + if(n >= MATE_SCORE) return 2*MATE_SCORE - n; + if(n <= -MATE_SCORE) return -2*MATE_SCORE - n; + return n; +} + +static int InsertionPoint (int len, EngineOutputData *ed) { int i, offs = 0, newScore = ed->score, n = ed->which; @@ -425,7 +433,7 @@ InsertionPoint (int len, EngineOutputData *ed) keys[i+n+2] = ed->moveKey; fail[i+n+2] = failType; if(ed->moveKey != keys[i+n] && // same move always tops previous one (as a higher score must be a fail low) - newScore < scores[i+n] && fail[i+n] == ' ') break; + MateFlip(newScore) < MateFlip(scores[i+n]) && fail[i+n] == ' ') break; // if it had higher score as previous, move previous in stead scores[i+n+2] = ed->moveKey == keys[i+n] ? newScore : scores[i+n]; // correct scores of fail-low/high searches textEnd[i+n+2] = textEnd[i+n] + len; @@ -443,7 +451,6 @@ InsertionPoint (int len, EngineOutputData *ed) return offs + strlen(header[ed->which]); } -#define MATE_SCORE 100000 static char spaces[] = " "; // [HGM] align: spaces for padding static void