fixed compiler warning
[rocksndiamonds.git] / src / screens.c
index 5195cacd33776452acc609b371898fa2ad5b7e3c..bf9f0a966348c1a9a9b4a82e764287ef8fed4c69 100644 (file)
@@ -1690,14 +1690,9 @@ static void gotoTopLevelDir(void)
     {
       int num_leveldirs = numTreeInfoInGroup(leveldir_current);
       int leveldir_pos = posTreeInfo(leveldir_current);
-      int num_page_entries;
+      int num_page_entries = MIN(num_leveldirs, NUM_MENU_ENTRIES_ON_SCREEN);
       int cl_first, cl_cursor;
 
-      if (num_leveldirs <= NUM_MENU_ENTRIES_ON_SCREEN)
-       num_page_entries = num_leveldirs;
-      else
-       num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
-
       cl_first = MAX(0, leveldir_pos - num_page_entries + 1);
       cl_cursor = leveldir_pos - cl_first;
 
@@ -1911,7 +1906,7 @@ static void HandleMainMenu_SelectLevel(int step, int direction,
 
   if (new_level_nr != old_level_nr)
   {
-    struct MainControlInfo *mci= getMainControlInfo(MAIN_CONTROL_LEVEL_NUMBER);
+    struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_LEVEL_NUMBER);
 
     PlaySound(SND_MENU_ITEM_SELECTING);
 
@@ -1932,9 +1927,8 @@ static void HandleMainMenu_SelectLevel(int step, int direction,
 
     UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
 
-    // needed because DrawPreviewLevelInitial() takes some time
-    BackToFront();
-    // SyncDisplay();
+    // force redraw of playfield area (may be reset at this point)
+    redraw_mask |= REDRAW_FIELD;
   }
 }
 
@@ -1944,7 +1938,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
   static boolean button_pressed_last = FALSE;
   boolean button_pressed = FALSE;
   int pos = choice;
-  int i;
+  int i = 0;   // needed to prevent compiler warning due to bad code below
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -4182,14 +4176,9 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
   int y = ti->cl_cursor;
   int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
   int num_entries = numTreeInfoInGroup(ti);
-  int num_page_entries;
+  int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
   boolean position_set_by_scrollbar = (dx == 999);
 
-  if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
-    num_page_entries = num_entries;
-  else
-    num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
-
   if (button == MB_MENU_INITIALIZE)
   {
     int num_entries = numTreeInfoInGroup(ti);
@@ -6175,6 +6164,17 @@ static struct
   { &setup.touch.grid_ysize[1],                execSetupChooseGridYSize_1      },
   { &setup.touch.grid_ysize[1],                &grid_size_text[1][1]           },
 
+  { &setup.internal.menu_game,         execSetupGame                   },
+  { &setup.internal.menu_editor,       execSetupEditor                 },
+  { &setup.internal.menu_graphics,     execSetupGraphics               },
+  { &setup.internal.menu_sound,                execSetupSound                  },
+  { &setup.internal.menu_artwork,      execSetupArtwork                },
+  { &setup.internal.menu_input,                execSetupInput                  },
+  { &setup.internal.menu_touch,                execSetupTouch                  },
+  { &setup.internal.menu_shortcuts,    execSetupShortcuts              },
+  { &setup.internal.menu_exit,         execExitSetup                   },
+  { &setup.internal.menu_save_and_exit,        execSaveAndExitSetup            },
+
   { NULL,                              NULL                            }
 };
 
@@ -8497,16 +8497,8 @@ static void CreateScreenMenubuttons(void)
 
     menubutton_info[i].get_gadget_position(&x, &y, id);
 
-    if (menubutton_info[i].screen_mask == SCREEN_MASK_MAIN_HAS_SOLUTION)
-    {
-      width  = graphic_info[menubutton_info[i].gfx_pressed].width;
-      height = graphic_info[menubutton_info[i].gfx_pressed].height;
-    }
-    else
-    {
-      width = SC_MENUBUTTON_XSIZE;
-      height = SC_MENUBUTTON_YSIZE;
-    }
+    width  = graphic_info[menubutton_info[i].gfx_pressed].width;
+    height = graphic_info[menubutton_info[i].gfx_pressed].height;
 
     gfx_unpressed = menubutton_info[i].gfx_unpressed;
     gfx_pressed   = menubutton_info[i].gfx_pressed;