moved drawing title of "choose tree" screen to separate function
authorHolger Schemel <info@artsoft.org>
Fri, 18 Feb 2022 17:42:14 +0000 (18:42 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 18 Feb 2022 17:42:14 +0000 (18:42 +0100)
src/screens.c

index 68b8c08497c440eff6c9c17de81e124d4d2f409c..de1c498f3535df62e0317d2965ddc8d1503985e4 100644 (file)
@@ -4948,20 +4948,26 @@ static void drawChooseTreeText(int y, boolean active, TreeInfo *ti)
   }
 }
 
-static void drawChooseTreeList(int first_entry, int num_page_entries,
-                              TreeInfo *ti)
+static void drawChooseTreeHeadExt(int type, char *title_string)
 {
-  int i;
-  char *title_string = NULL;
   int yoffset_sets = MENU_TITLE1_YPOS;
   int yoffset_setup = 16;
-  int yoffset = (ti->type == TREE_TYPE_SCORE_ENTRY ||
-                ti->type == TREE_TYPE_LEVEL_DIR ||
-                ti->type == TREE_TYPE_LEVEL_NR ? yoffset_sets : yoffset_setup);
-
-  title_string = ti->infotext;
+  int yoffset = (type == TREE_TYPE_SCORE_ENTRY ||
+                type == TREE_TYPE_LEVEL_DIR ||
+                type == TREE_TYPE_LEVEL_NR ? yoffset_sets : yoffset_setup);
 
   DrawTextSCentered(mSY - SY + yoffset, FONT_TITLE_1, title_string);
+}
+
+static void drawChooseTreeHead(TreeInfo *ti)
+{
+  drawChooseTreeHeadExt(ti->type, ti->infotext);
+}
+
+static void drawChooseTreeList(int first_entry, int num_page_entries,
+                              TreeInfo *ti)
+{
+  int i;
 
   clearMenuListArea();
 
@@ -5042,6 +5048,7 @@ static void drawChooseTreeScreen(TreeInfo *ti)
   int num_entries = numTreeInfoInGroup(ti);
   int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
 
+  drawChooseTreeHead(ti);
   drawChooseTreeList(ti->cl_first, num_page_entries, ti);
   drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
   drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti);