projects
/
xboard.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9a4dfcc
)
Alow promotions and drops in book-editing
author
H.G. Muller
<h.g.muller@hccnet.nl>
Wed, 11 May 2011 20:48:34 +0000
(22:48 +0200)
committer
H.G. Muller
<h.g.muller@hccnet.nl>
Wed, 11 May 2011 20:48:34 +0000
(22:48 +0200)
book.c
patch
|
blob
|
history
diff --git
a/book.c
b/book.c
index
9b02936
..
e5a6030
100644
(file)
--- 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;
}
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++;
entries[count].key = hashKey;
entries[count].weight = w;
count++;