X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=blobdiff_plain;f=book.c;h=9828dd24e3d09decce7d4e5e45b1914489de2b94;hp=090ae1b269ad8a38aa3334191147b79e90a01080;hb=HEAD;hpb=e921ccb3b79c9cfc5657e715eb50b5d9ed298db8 diff --git a/book.c b/book.c index 090ae1b..9828dd2 100644 --- a/book.c +++ b/book.c @@ -315,7 +315,7 @@ hash (int moveNr) if(p != EmptySquare){ int j = (int)p, promoted = 0; j -= (j >= (int)BlackPawn) ? (int)BlackPawn :(int)WhitePawn; - if(j >= CHUPROMOTED WhitePawn) promoted++, j -= CHUPROMOTED WhitePawn; + if(j >= WhitePBishop && j != WhiteKing) promoted++, j -= WhiteTokin; if(j > (int)WhiteQueen) j++; // make space for King if(j > (int) WhiteKing) j = (int)WhiteQueen + 1; p_enc = 2*j + ((int)p < (int)BlackPawn); @@ -647,7 +647,7 @@ InitMemBook () } char * -MCprobe (moveNr) +MCprobe (int moveNr) { int count, count2, games, i, choice=0; entry_t entries[MOVE_BUF]; @@ -742,6 +742,9 @@ MovesToText(int count, entry_t *entries) move_to_string(algMove, entries[i].move); if(sscanf(algMove, "%c%d%*c%*d,%c%d%c%d", &c1, &i1, &c2, &i2, &c3, &i3) == 6) snprintf(algMove, 12, "%c%dx%c%d-%c%d", c1, i1, c2, i2, c3, i3); // cast double-moves in format SAN parser will understand + else if(sscanf(algMove, "%c%d%c%d%c", &c1, &i1, &c2, &i2, &c3) >= 4) { + CoordsToAlgebraic(boards[currentMove], PosFlags(currentMove), i1-ONE+'0', c1-AAA, i2-ONE+'0', c2-AAA, c3, algMove); + } buf[0] = NULLCHAR; if(entries[i].learnCount || entries[i].learnPoints) snprintf(buf, MSG_SIZ, " {%d/%d}", entries[i].learnPoints, entries[i].learnCount); @@ -1026,7 +1029,8 @@ PlayBookMove(char *text, int index) { char *start = text+index, *end = start; while(start > text && start[-1] != ' ' && start[-1] != '\t') start--; - while(*end && *++end != ' ' && *end != '\n'); *end = NULLCHAR; // find clicked word + while(*end && *++end != ' ' && *end != '\n') + ; *end = NULLCHAR; // find clicked word if(start != end) TypeInDoneEvent(start); // fake it was typed in move type-in }