X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=binloader.cpp;fp=binloader.cpp;h=5bf2502c6867610fbb963c91d63aaf3f717312c8;hb=55481cd69d21b31bfdcc6e33853ea475ed16f622;hp=6472f1009f73a0f0348e43ddd1656a4df86adfca;hpb=4a7c263734f23fc6b2ef0e6f8adb1ce344a22053;p=remoteglot-book diff --git a/binloader.cpp b/binloader.cpp index 6472f10..5bf2502 100644 --- a/binloader.cpp +++ b/binloader.cpp @@ -25,6 +25,7 @@ struct Element { Result result; int opening_num, white_elo, black_elo; time_t timestamp; + long start_position; bool operator< (const Element& other) const { return bpfen < other.bpfen; @@ -68,6 +69,7 @@ int main(int argc, char **argv) int opening_num, white_elo, black_elo; time_t timestamp; + long start_position; if (fread(&white_elo, sizeof(white_elo), 1, fp) != 1) { perror("fread()"); //exit(1); @@ -88,6 +90,12 @@ int main(int argc, char **argv) //exit(1); break; } + if (fread(&start_position, sizeof(start_position), 1, fp) != 1) { + perror("fread()"); + //exit(1); + break; + } + l = getc(fp); if (l == -1) { @@ -102,7 +110,7 @@ int main(int argc, char **argv) } int bucket = hash_key_to_bucket(bpfen.data(), bpfen.size(), num_buckets); - elems[bucket].emplace_back(Element {std::move(bpfen), std::move(move), Result(r), opening_num, white_elo, black_elo, timestamp}); + elems[bucket].emplace_back(Element {std::move(bpfen), std::move(move), Result(r), opening_num, white_elo, black_elo, timestamp, start_position}); ++num_elems; } fclose(fp); @@ -145,6 +153,7 @@ int main(int argc, char **argv) c.set_first_timestamp(e.timestamp); } c.set_opening_num(e.opening_num); + c.set_pgn_start_position(e.start_position); } if (!moves.count(e.move)) { moves.insert(e.move);