racing:: save records

This commit is contained in:
Zeno Rogue 2022-06-16 23:11:22 +02:00
parent d2bd8933dd
commit b888205a17
1 changed files with 20 additions and 5 deletions

View File

@ -173,10 +173,6 @@ EX void initgame() {
firstland = safetyland;
}
#if CAP_RACING
if(racing::on) racing::apply_seed();
#endif
if(!safety) {
firstland = specialland;
ineligible_starting_land = !landUnlocked(specialland);
@ -1028,7 +1024,8 @@ EX void saveStats(bool emergency IS(false)) {
if(peace::on) return;
if(dpgen::in) return;
if(experimental) return;
if(!gold()) return;
if(!gold() && !racing::on) return;
remove_emergency_save();
@ -1084,6 +1081,16 @@ EX void saveStats(bool emergency IS(false)) {
return;
}
if(racing::on) {
if(racing::official_race && !cheater) {
fprintf(f, "RACING %s %d %d date: %s\n", VER,
int(specialland), racing::best_scores[specialland],
buf);
fclose(f);
}
return;
}
fprintf(f, "HyperRogue: game statistics (version " VER ")\n");
if(cheater)
fprintf(f, "CHEATER! (cheated %d times)\n", cheater);
@ -1250,6 +1257,14 @@ EX void loadsave() {
}
}
if(buf[0] == 'R' && buf[1] == 'A' && buf[2] == 'C') {
char buf1[80], ver[10];
int land, score;
sscanf(buf, "%70s%9s%d%d", buf1, ver, &land, &score);
racing::best_scores[eLand(land)] = score;
println(hlog, "loaded the score for ", dnameof(eLand(land)), " of ", score);
}
}
fclose(f);
if(ok && sc.box[65 + 4 + itOrbSafety - itOrbLightning])