fixed bug with not unmapping gadgets from previous screen on score info
[rocksndiamonds.git] / src / screens.c
index f07f7030225691b21e273f4c1a1fdb23e5c0c691..b5cef16637aba7a2cee5e1428b95cc5609d06fea 100644 (file)
@@ -5145,6 +5145,9 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
   int num_entries = numTreeInfoInGroup(ti);
   int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
   boolean position_set_by_scrollbar = (dx == 999);
+  boolean button_action = (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE);
+  boolean button_is_valid = (mx >= 0 && my >= 0);
+  boolean button_screen_clicked = (button_action && button_is_valid);
 
   if (game_status == GAME_MODE_SCORES)
   {
@@ -5172,7 +5175,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
       {
        drawChooseTreeScreen_Scores_NotAvailable();
       }
-      else if (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE)
+      else if (button_screen_clicked)
       {
        PlaySound(SND_MENU_ITEM_SELECTING);
 
@@ -5804,7 +5807,7 @@ static char *getHallOfFameScoreText(int nr)
 
 static void HandleHallOfFame_SelectLevel(int step, int direction)
 {
-  int old_level_nr = level_nr;
+  int old_level_nr = scores.last_level_nr;
   int new_level_nr = old_level_nr + step * direction;
 
   if (new_level_nr < leveldir_current->first_level)
@@ -5866,6 +5869,8 @@ static void DrawScoreInfo(int pos)
 
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_SCOREINFO);
 
+  UnmapAllGadgets();
+
   FadeOut(REDRAW_FIELD);
 
   ClearField();