moved getting title strings from config files to separate functions
authorHolger Schemel <info@artsoft.org>
Sat, 10 Mar 2018 19:10:08 +0000 (20:10 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:17 +0000 (23:21 +0100)
src/config.c
src/config.h
src/screens.c

index 8a92ebb445cce90a857ad67794d2dd654ce6cb79..fe40a69769a255ebb20c146f78c67193887fd6df 100644 (file)
@@ -57,6 +57,42 @@ char *getProgramInitString()
   return program_init_string;
 }
 
+char *getConfigProgramTitleString()
+{
+  TreeInfo *graphics_current =
+    getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
+
+  return (leveldir_current->program_title ?
+         leveldir_current->program_title :
+         graphics_current->program_title ?
+         graphics_current->program_title :
+         setup.internal.program_title);
+}
+
+char *getConfigProgramCopyrightString()
+{
+  TreeInfo *graphics_current =
+    getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
+
+  return (leveldir_current->program_copyright ?
+         leveldir_current->program_copyright :
+         graphics_current->program_copyright ?
+         graphics_current->program_copyright :
+         setup.internal.program_copyright);
+}
+
+char *getConfigProgramCompanyString()
+{
+  TreeInfo *graphics_current =
+    getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
+
+  return (leveldir_current->program_company ?
+         leveldir_current->program_company :
+         graphics_current->program_company ?
+         graphics_current->program_company :
+         setup.internal.program_company);
+}
+
 char *getWindowTitleString()
 {
   static char *window_title_string = NULL;
index 12e19614ed3d3c9659d933243865389e0d53338d..9395b7b22dfb528afccc5a9f52041cf2f33453db 100644 (file)
@@ -19,6 +19,9 @@ char *getProgramTitleString(void);
 char *getProgramRealVersionString(void);
 char *getProgramVersionString(void);
 char *getProgramInitString(void);
+char *getConfigProgramTitleString();
+char *getConfigProgramCopyrightString();
+char *getConfigProgramCompanyString();
 char *getWindowTitleString(void);
 
 #endif /* CONFIG_H */
index 680b2e62170e727c80e515b5bf1cb35925df6187..cfe42f04ce1965c310b2e62bb06d7b472ebd5348 100644 (file)
@@ -1000,8 +1000,6 @@ static boolean visibleTextPos(struct TextPosInfo *pos)
 
 static void InitializeMainControls()
 {
-  TreeInfo *graphics_current =
-    getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
   boolean local_team_mode = (!options.network && setup.team_mode);
   int i;
 
@@ -1020,21 +1018,9 @@ static void InitializeMainControls()
   main_text_level_imported_by  = leveldir_current->imported_by;
   main_text_level_tested_by    = leveldir_current->tested_by;
 
-  main_text_title_1 = (leveldir_current->program_title ?
-                      leveldir_current->program_title :
-                      graphics_current->program_title ?
-                      graphics_current->program_title :
-                      setup.internal.program_title);
-  main_text_title_2 = (leveldir_current->program_copyright ?
-                      leveldir_current->program_copyright :
-                      graphics_current->program_copyright ?
-                      graphics_current->program_copyright :
-                      setup.internal.program_copyright);
-  main_text_title_3 = (leveldir_current->program_company ?
-                      leveldir_current->program_company :
-                      graphics_current->program_company ?
-                      graphics_current->program_company :
-                      setup.internal.program_company);
+  main_text_title_1 = getConfigProgramTitleString();
+  main_text_title_2 = getConfigProgramCopyrightString();
+  main_text_title_3 = getConfigProgramCompanyString();
 
   /* set main control screen positions to dynamically determined values */
   for (i = 0; main_controls[i].nr != -1; i++)