X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=output.c;h=a403488375b878a2035259267c2df9dd1dbfd41e;hb=HEAD;hp=9c57e3195f1678ddf9db3e5f3421cd19b26c6597;hpb=4bd95337cff125af9e7ab500d3566a3b18ba65dd;p=pgn-extract diff --git a/output.c b/output.c index 9c57e31..a403488 100644 --- a/output.c +++ b/output.c @@ -1180,6 +1180,10 @@ output_sesse_bin_game(Game current_game,FILE *outputfile, // Find the result. Skip games with no result. for (move = current_game.moves; move != NULL; move = move->next) { + if (move->class == NULL_MOVE) { + // Skip games with null moves. + return; + } if (move->terminating_result) { result = move->terminating_result; } @@ -1212,6 +1216,7 @@ output_sesse_bin_game(Game current_game,FILE *outputfile, } int file_num = current_game.file_number; long start_position = current_game.start_position; + int computer_flag = GlobalState.computer_flag; // Parse date and time, if it exists. Set invalid dates to year 3000. const char *date_tag = current_game.tags[DATE_TAG]; @@ -1254,6 +1259,7 @@ output_sesse_bin_game(Game current_game,FILE *outputfile, fwrite(×tamp, sizeof(timestamp), 1, outputfile); fwrite(&file_num, sizeof(file_num), 1, outputfile); fwrite(&start_position, sizeof(start_position), 1, outputfile); + putc(computer_flag, outputfile); putc(strlen((char *)move->move), outputfile); fwrite(move->move, strlen((char *)move->move), 1, outputfile); @@ -1278,6 +1284,7 @@ output_sesse_bin_game(Game current_game,FILE *outputfile, fwrite(×tamp, sizeof(timestamp), 1, outputfile); fwrite(&file_num, sizeof(file_num), 1, outputfile); fwrite(&start_position, sizeof(start_position), 1, outputfile); + putc(computer_flag, outputfile); putc(0, outputfile); // No move. free(bpfen);