From: Steinar H. Gunderson Date: Wed, 10 Dec 2014 23:19:43 +0000 (+0100) Subject: Store opening choices for each move. X-Git-Url: https://git.sesse.net/?p=pgn-extract;a=commitdiff_plain;h=90d1f7dcb4fca2147969f9fe179ad063d423fced Store opening choices for each move. --- diff --git a/apply.c b/apply.c index bd7b472..c58e16d 100644 --- a/apply.c +++ b/apply.c @@ -903,6 +903,7 @@ play_moves(Game *game_details, Board *board, Move *moves, unsigned max_depth, eco_match = entry; } } + next_move->eco = eco_match; } next_move = next_move->next; } diff --git a/output.c b/output.c index 6e47275..297cf8b 100644 --- a/output.c +++ b/output.c @@ -34,6 +34,7 @@ #include "apply.h" #include "output.h" #include "mymalloc.h" +#include "eco.h" /* Functions for outputting games in the required format. */ @@ -1205,7 +1206,7 @@ output_sesse_bin_game(Game current_game,FILE *outputfile, int black_elo = atoi(black_elo_tag); for (move = current_game.moves; move != NULL; move = move->next) { - unsigned int opening = 0; // TODO + unsigned int opening = move->eco ? move->eco->cumulative_hash_value : 0; // key putc(move->bpfen_len + strlen((char *)move->move), outputfile); diff --git a/typedef.h b/typedef.h index f405a63..df0d81d 100644 --- a/typedef.h +++ b/typedef.h @@ -70,6 +70,9 @@ typedef struct variation{ */ #define MAX_MOVE_LEN 15 +struct EcoLog; +typedef struct EcoLog EcoLog; + /* Retain the text of a move and any associated * NAGs and comments. */ @@ -106,6 +109,7 @@ typedef struct move{ /* terminating_result hold the result of the current list of moves. */ char *terminating_result; Variation *Variants; + EcoLog *eco; /* Pointers to the previous and next move. * The extraction program does not need the prev field, but my * intention is to build other interfaces that might need it.