X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=book.c;h=dc814586ecd335bd8a3743945ba2315f6286477d;hb=50bc241d1d9c026d128eb29c7f3bdc2ba5525c46;hp=e4916154d0a48beac1e645580c5a9477c2db3c0b;hpb=1c03d229073e56dda9e5856db5adaae51576a3bb;p=xboard.git diff --git a/book.c b/book.c index e491615..dc81458 100644 --- a/book.c +++ b/book.c @@ -28,6 +28,8 @@ * ------------------------------------------------------------------------ */ +#include "config.h" + #include #include #include @@ -757,7 +759,12 @@ TextToMoves (char *text, int moveNum, entry_t *entries) if(w == 1) text = strstr(text, "1 ") + 2; // skip weight that could be recognized as move number one valid = ParseOneMove(text, moveNum, &moveType, &fromX, &fromY, &toX, &toY, &promoChar); text = strstr(text, yy_textstr) + strlen(yy_textstr); // skip what we parsed - if(!valid || moveType != NormalMove) continue; + 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; } else { @@ -787,6 +794,7 @@ DisplayBook (int moveNr) p = MovesToText(count, entries); EditTagsPopUp(p, NULL); free(p); + addToBookFlag = FALSE; return TRUE; } @@ -979,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;