From: Holger Schemel Date: Sat, 1 May 2021 23:19:14 +0000 (+0200) Subject: added reloading server scores after download has finished X-Git-Tag: 4.3.0.0~166 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fdb8c9a6ae3d2ed960506a57ddca1bafc55a67ea;p=rocksndiamonds.git added reloading server scores after download has finished --- diff --git a/src/files.c b/src/files.c index 4be8f302..b3aa171b 100644 --- a/src/files.c +++ b/src/files.c @@ -8439,6 +8439,8 @@ static void setScoreInfoToDefaultsExt(struct ScoreInfo *scores) scores->num_entries = 0; scores->last_added = -1; scores->last_added_local = -1; + + scores->updated = FALSE; } static void setScoreInfoToDefaults(void) @@ -8985,6 +8987,8 @@ static void DownloadServerScoreToCacheExt(struct HttpRequest *request, fclose(file); SetFilePermissions(filename, PERMS_PRIVATE); + + server_scores.updated = TRUE; } static void DownloadServerScoreToCache(int nr) diff --git a/src/main.h b/src/main.h index fe1106db..1b9e7cb6 100644 --- a/src/main.h +++ b/src/main.h @@ -3058,6 +3058,8 @@ struct ScoreInfo int last_added; int last_added_local; + boolean updated; + struct ScoreEntry entry[MAX_SCORE_ENTRIES]; }; diff --git a/src/screens.c b/src/screens.c index 5aa80c9c..4fb4e148 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5153,6 +5153,14 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) { level_nr = mx; + if (server_scores.updated) + { + // reload scores, using updated server score cache file + LoadLocalAndServerScore(level_nr, FALSE); + + server_scores.updated = FALSE; + } + first_entry = getHallOfFameFirstEntry(0, 0); drawHallOfFameList(level_nr, first_entry); @@ -5196,6 +5204,17 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) DrawMainMenu(); } } + else if (server_scores.updated) + { + // reload scores, using updated server score cache file + LoadLocalAndServerScore(level_nr, FALSE); + + server_scores.updated = FALSE; + + first_entry = getHallOfFameFirstEntry(0, 0); + + drawHallOfFameList(level_nr, first_entry); + } if (game_status == GAME_MODE_SCORES) PlayMenuSoundIfLoop();