From: Holger Schemel Date: Fri, 14 May 2021 15:54:38 +0000 (+0200) Subject: forced displaying last added high score entry X-Git-Tag: 4.3.0.0~151 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1bfe89eeb29cd7c2b35d14b871627f5504e2756e;p=rocksndiamonds.git forced displaying last added high score entry --- diff --git a/src/files.c b/src/files.c index 8f04a366..51e674cd 100644 --- a/src/files.c +++ b/src/files.c @@ -8490,6 +8490,7 @@ static void setScoreInfoToDefaultsExt(struct ScoreInfo *scores) scores->last_added_local = -1; scores->updated = FALSE; + scores->force_last_added = FALSE; } static void setScoreInfoToDefaults(void) diff --git a/src/game.c b/src/game.c index f5ed6756..914c2520 100644 --- a/src/game.c +++ b/src/game.c @@ -5144,9 +5144,13 @@ void NewHighScore(int level_nr) void MergeServerScore(void) { + struct ScoreEntry last_added_entry; boolean one_per_name = !program.many_scores_per_name; int i; + if (scores.last_added >= 0) + last_added_entry = scores.entry[scores.last_added]; + for (i = 0; i < server_scores.num_entries; i++) { int pos = addScoreEntry(&scores, &server_scores.entry[i], one_per_name); @@ -5156,7 +5160,12 @@ void MergeServerScore(void) } if (scores.last_added >= MAX_SCORE_ENTRIES) - scores.last_added = -1; + { + scores.last_added = MAX_SCORE_ENTRIES - 1; + scores.force_last_added = TRUE; + + scores.entry[scores.last_added] = last_added_entry; + } } static int getElementMoveStepsizeExt(int x, int y, int direction) diff --git a/src/main.h b/src/main.h index e9844b22..fe3e025c 100644 --- a/src/main.h +++ b/src/main.h @@ -3059,6 +3059,7 @@ struct ScoreInfo int last_added_local; boolean updated; + boolean force_last_added; struct ScoreEntry entry[MAX_SCORE_ENTRIES]; }; diff --git a/src/screens.c b/src/screens.c index 2f3ff410..4bd24b50 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5117,6 +5117,7 @@ static void drawHallOfFameList(int level_nr, int first_entry) { int entry = first_entry + i; boolean active = (entry == scores.last_added); + boolean forced = (scores.force_last_added && active); int font_nr1 = (active ? FONT_TEXT_1_ACTIVE : FONT_TEXT_1); int font_nr2 = (active ? FONT_TEXT_2_ACTIVE : FONT_TEXT_2); int font_nr3 = (active ? FONT_TEXT_3_ACTIVE : FONT_TEXT_3); @@ -5127,8 +5128,9 @@ static void drawHallOfFameList(int level_nr, int first_entry) int dx3 = SXSIZE - 2 * (mSX - SX + dxoff) - 5 * getFontWidth(font_nr4); int num_dots = (dx3 - dx2) / getFontWidth(font_nr3); int sy = mSY + 64 + i * 32; + char *pos_text = (forced ? "???" : int2str(entry + 1, 3)); - DrawText(mSX, sy, int2str(entry + 1, 3), font_nr1); + DrawText(mSX, sy, pos_text, font_nr1); DrawText(mSX + dx1, sy, ".", font_nr1); for (j = 0; j < num_dots; j++)