X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=book.c;h=e5a6030bb67b533e2ef3247b075dc42e0456d5f6;hb=9b980cf4a3a0e555c16f50b7b198773a3fd2d8f2;hp=9b0293689c4dcd1c03b701537bf7e4b75c543aaa;hpb=9a4dfcc5cc870b1f5dd88fa91ad0644d842e84b4;p=xboard.git diff --git a/book.c b/book.c index 9b02936..e5a6030 100644 --- a/book.c +++ b/book.c @@ -587,8 +587,10 @@ int TextToMoves(char *text, int moveNum, entry_t *entries) } to = toX + toY * width; from = fromX + fromY * width; - // TODO: promotions, drops - entries[count].move = to + from * width * BOARD_HEIGHT; + for(i=0; promote_pieces[i]; i++) if(promote_pieces[i] == promoChar) break; + if(!promote_pieces[i]) i = 0; + if(fromY == DROP_RANK) i = 8, from = ToUpper(PieceToChar(fromX)) - '@'; + entries[count].move = to + (i * width * BOARD_HEIGHT + from) * width * BOARD_HEIGHT; entries[count].key = hashKey; entries[count].weight = w; count++;