mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
racing fixed (hopefully)
This commit is contained in:
parent
884a9bb2c5
commit
0dc84d8f34
@ -80,6 +80,7 @@ vector<ghost> ghostset;
|
||||
array<vector<ghostmoment>, MAXPLAYER> current_history;
|
||||
|
||||
EX map<eLand, int> best_scores;
|
||||
EX map<eLand, int> best_scores_to_save;
|
||||
|
||||
string ghost_prefix = "default";
|
||||
|
||||
@ -1287,6 +1288,7 @@ EX void race_won() {
|
||||
if(!best_scores.count(specialland))
|
||||
best_scores[specialland] = result;
|
||||
best_scores[specialland] = min(best_scores[specialland], result);
|
||||
best_scores_to_save[specialland] = result;
|
||||
saveStats();
|
||||
if(official_race) uploadScore();
|
||||
}
|
||||
|
@ -1081,11 +1081,13 @@ EX void saveStats(bool emergency IS(false)) {
|
||||
|
||||
#if CAP_RACING
|
||||
if(racing::on) {
|
||||
if(racing::official_race && !cheater) {
|
||||
auto& bs = racing::best_scores_to_save;
|
||||
if(racing::official_race && !cheater && bs.count(specialland)) {
|
||||
fprintf(f, "RACING %s %d %d date: %s\n", VER,
|
||||
int(specialland), racing::best_scores[specialland],
|
||||
int(specialland), bs[specialland],
|
||||
buf);
|
||||
fclose(f);
|
||||
bs.erase(specialland);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1262,7 +1264,8 @@ EX void loadsave() {
|
||||
char buf1[80], ver[10];
|
||||
int land, score;
|
||||
sscanf(buf, "%70s%9s%d%d", buf1, ver, &land, &score);
|
||||
racing::best_scores[eLand(land)] = score;
|
||||
/* score may equal 0 because of earlier bugs */
|
||||
if(score) racing::best_scores[eLand(land)] = score;
|
||||
println(hlog, "loaded the score for ", dnameof(eLand(land)), " of ", score);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user