X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=book.c;h=dc814586ecd335bd8a3743945ba2315f6286477d;hb=9df530983c4dc4dff2ffc1c1e1efacf455adebf1;hp=2bb542f2c981d021cd2c5536db06ab56f9f3f254;hpb=2e9bcff39eba2e59cce8502bc68c6c18dd2776f6;p=xboard.git diff --git a/book.c b/book.c index 2bb542f..dc81458 100644 --- a/book.c +++ b/book.c @@ -28,6 +28,8 @@ * ------------------------------------------------------------------------ */ +#include "config.h" + #include #include #include @@ -759,6 +761,9 @@ TextToMoves (char *text, int moveNum, entry_t *entries) text = strstr(text, yy_textstr) + strlen(yy_textstr); // skip what we parsed if(!valid || moveType != NormalMove && moveType != WhiteDrop && moveType != BlackDrop && moveType != WhitePromotion && moveType != BlackPromotion + && moveType != WhiteCapturesEnPassant && moveType != BlackCapturesEnPassant + && moveType != WhiteKingSideCastle && moveType != BlackKingSideCastle + && moveType != WhiteQueenSideCastle && moveType != BlackQueenSideCastle && moveType != WhiteNonPromotion && moveType != BlackNonPromotion) continue; if(*text == ' ' && sscanf(text+1, "{%hd/%hd}", &entries[count].learnPoints, &entries[count].learnCount) == 2) { text = strchr(text+1, '}') + 1; @@ -789,6 +794,7 @@ DisplayBook (int moveNr) p = MovesToText(count, entries); EditTagsPopUp(p, NULL); free(p); + addToBookFlag = FALSE; return TRUE; } @@ -981,6 +987,15 @@ AddGameToBook (int always) } void +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 + if(start != end) TypeInDoneEvent(start); // fake it was typed in move type-in +} + +void FlushBook () { FILE *f;