From bc789e8c1842072d8b9339036f9af50d88217759 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 27 Sep 2019 17:34:42 +0200 Subject: [PATCH] racing:: fixed racing to use modecode_t not int --- hprint.cpp | 8 ++++++++ racing.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hprint.cpp b/hprint.cpp index 083d1fbf..6c1e5b25 100644 --- a/hprint.cpp +++ b/hprint.cpp @@ -299,9 +299,17 @@ EX string llts(long long i) { if(i < 10) return its((int) i); return llts(i/10) + its(i%10); } +EX string itsh(unsigned int i) {static char buf[16]; sprintf(buf, "%03X", i); return buf; } EX string itsh(int i) {static char buf[16]; sprintf(buf, "%03X", i); return buf; } EX string itsh2(int i) {static char buf[16]; sprintf(buf, "%02X", i); return buf; } +EX string itsh(unsigned long long i) { + int i0 = int(i); + int i1 = int(i >> 32); + if(i1) return itsh(i1) + itsh8(i0); + else return itsh(i0); + } + EX logger hlog; // kz: utility for printing diff --git a/racing.cpp b/racing.cpp index 5e33d838..6e2f82dd 100644 --- a/racing.cpp +++ b/racing.cpp @@ -83,9 +83,9 @@ struct ghost { }; typedef map> raceset; -map, raceset> race_ghosts; +map, raceset> race_ghosts; -map, raceset> official_race_ghosts; +map, raceset> official_race_ghosts; raceset& ghostset() { return race_ghosts[make_pair(track_code, modecode())]; } raceset& oghostset() { return official_race_ghosts[make_pair(track_code, modecode())]; } @@ -103,7 +103,7 @@ array, MAXPLAYER> current_history; string ghost_prefix = "default"; #if CAP_FILES -string ghost_filename(string seed, int mcode) { +string ghost_filename(string seed, modecode_t mcode) { if(ghost_prefix == "default") { #ifdef FHS if(getenv("HOME")) { @@ -140,7 +140,7 @@ void hwrite(hstream& hs, const ghost& gh) { hwrite(hs, gh.cs, gh.result, gh.timestamp, gh.checksum, gh.history); } -bool read_ghosts(string seed, int mcode) { +bool read_ghosts(string seed, modecode_t mcode) { if(seed == "OFFICIAL" && mcode == 2) { fhstream f("officials.data", "rb");