racing:: fixed racing to use modecode_t not int

This commit is contained in:
Zeno Rogue 2019-09-27 17:34:42 +02:00
parent 3d7242e918
commit bc789e8c18
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -83,9 +83,9 @@ struct ghost {
};
typedef map<eLand, vector<ghost>> raceset;
map<pair<string, int>, raceset> race_ghosts;
map<pair<string, modecode_t>, raceset> race_ghosts;
map<pair<string, int>, raceset> official_race_ghosts;
map<pair<string, modecode_t>, 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<vector<ghostmoment>, 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");