moved code to separate function
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 17 Nov 2024 23:08:47 +0000 (00:08 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 17 Nov 2024 23:08:47 +0000 (00:08 +0100)
src/screens.c

index 944c78802b4b80d12326185fdb1ebacc13f52f17..c3629605c590417f0d0cb6c227386c023e001c70 100644 (file)
@@ -1892,11 +1892,9 @@ static void drawChooseTreeEdit(int ypos_raw, boolean active)
   DrawText(sx, sy, STR_CHOOSE_TREE_EDIT, font_nr);
 }
 
-static void DrawInfoScreen_Headline(int screen_nr, int num_screens,
-                                   int use_global_screens)
+static char *getInfoScreenSubtitle(int screen_nr, int num_screens, int use_global_screens)
 {
-  char *info_text_title_1 = getInfoScreenTitle_Generic();
-  char info_text_title_2[MAX_LINE_LEN + 1];
+  static char info_text_title_2[MAX_LINE_LEN + 1];
   boolean draw_story_headline = (info_mode == INFO_MODE_STORY && hasLevelStory());
 
   if (num_screens > 1)
@@ -1925,6 +1923,15 @@ static void DrawInfoScreen_Headline(int screen_nr, int num_screens,
     snprintf(info_text_title_2, max_text_len, text_format, name_cut);
   }
 
+  return info_text_title_2;
+}
+
+static void DrawInfoScreen_Headline(int screen_nr, int num_screens, int use_global_screens)
+{
+  char *info_text_title_1 = getInfoScreenTitle_Generic();
+  char *info_text_title_2 = getInfoScreenSubtitle(screen_nr, num_screens, use_global_screens);
+  boolean draw_story_headline = (info_mode == INFO_MODE_STORY && hasLevelStory());
+
   if (draw_story_headline)
   {
     DrawTextSCentered(MENU_TITLE_STORY_YPOS, FONT_TITLE_STORY, info_text_title_2);