changed using always the same width for high score list in hall of fame
[rocksndiamonds.git] / src / screens.c
index d208c3a464723bd99a245cfb273c156aa8f18a91..f62d84fbe1cdefadf8fddd874d0c852be3c2f035 100644 (file)
@@ -4907,8 +4907,10 @@ static void drawChooseTreeText(TreeInfo *ti, int y, boolean active)
 {
   int num_entries = numTreeInfoInGroup(ti);
   boolean scrollbar_needed = (num_entries > NUM_MENU_ENTRIES_ON_SCREEN);
+  boolean scrollbar_always = (game_status == GAME_MODE_SCORES);
+  boolean scrollbar_keep_space = (scrollbar_needed || scrollbar_always);
   int scrollbar_xpos = SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset;
-  int screen_width = (scrollbar_needed ? scrollbar_xpos : SXSIZE);
+  int screen_width = (scrollbar_keep_space ? scrollbar_xpos : SXSIZE);
   int first_entry = ti->cl_first;
   int entry_pos = first_entry + y;
   TreeInfo *node_first = getTreeInfoFirstGroupEntry(ti);
@@ -5713,7 +5715,9 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
 
 static void DrawHallOfFame_setScoreEntries(void)
 {
-  int num_visible_score_entries = NUM_MENU_ENTRIES_ON_SCREEN - 1;
+  int max_empty_entries = 10;  // at least show "top ten" list, if empty
+  int max_visible_entries = NUM_MENU_ENTRIES_ON_SCREEN - 1;   // w/o back link
+  int min_score_entries = MIN(max_empty_entries, max_visible_entries);
   int score_pos = (scores.last_added >= 0 ? scores.last_added : 0);
   int i;
 
@@ -5729,7 +5733,7 @@ static void DrawHallOfFame_setScoreEntries(void)
     // do not add empty score entries if off-screen
     if (scores.entry[i].score == 0 &&
        scores.entry[i].time == 0 &&
-       i >= num_visible_score_entries)
+       i >= min_score_entries)
       break;
 
     TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_SCORE_ENTRY);
@@ -5842,6 +5846,7 @@ static void HandleHallOfFame_SelectLevel(int step, int direction)
     PlaySound(SND_MENU_ITEM_SELECTING);
 
     scores.last_level_nr = level_nr = new_level_nr;
+    scores.last_entry_nr = 0;
 
     LoadLevel(level_nr);
     LoadLocalAndServerScore(level_nr, TRUE);
@@ -5863,8 +5868,6 @@ static void HandleHallOfFame_SelectLevel(int step, int direction)
     }
     else
     {
-      scores.last_entry_nr = 0;
-
       DrawScoreInfo_Content(scores.last_entry_nr);
     }