From: Holger Schemel Date: Sat, 10 Mar 2018 19:10:08 +0000 (+0100) Subject: moved getting title strings from config files to separate functions X-Git-Tag: 4.1.0.0~23 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=e357ec2b5e90659499a8f5bd23c5dce6d0769826 moved getting title strings from config files to separate functions --- diff --git a/src/config.c b/src/config.c index 8a92ebb4..fe40a697 100644 --- a/src/config.c +++ b/src/config.c @@ -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; diff --git a/src/config.h b/src/config.h index 12e19614..9395b7b2 100644 --- a/src/config.h +++ b/src/config.h @@ -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 */ diff --git a/src/screens.c b/src/screens.c index 680b2e62..cfe42f04 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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++)