version number set to 4.2.2.0
[rocksndiamonds.git] / src / config.c
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // config.c
10 // ============================================================================
11
12 #include "libgame/libgame.h"
13
14 #include "config.h"
15 #include "conftime.h"
16 #include "confhash.h"
17
18
19 char *getSourceDateString(void)
20 {
21   return SOURCE_DATE_STRING;
22 }
23
24 char *getSourceHashString(void)
25 {
26   return SOURCE_HASH_STRING;
27 }
28
29 char *getProgramTitleString(void)
30 {
31   return program.program_title;
32 }
33
34 char *getProgramRealVersionString(void)
35 {
36   static char program_version_string[32];
37
38   sprintf(program_version_string, "%d.%d.%d.%d%s",
39           PROGRAM_VERSION_SUPER, PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR,
40           PROGRAM_VERSION_PATCH, PROGRAM_VERSION_EXTRA);
41
42   return program_version_string;
43 }
44
45 char *getProgramVersionString(void)
46 {
47   return program.version_string;
48 }
49
50 char *getProgramInitString(void)
51 {
52   static char *program_init_string = NULL;
53
54   if (program_init_string == NULL)
55   {
56     program_init_string = checked_malloc(strlen(getProgramTitleString()) + 1 +
57                                          strlen(getProgramVersionString()) + 1);
58
59     sprintf(program_init_string, "%s %s",
60             getProgramTitleString(), getProgramVersionString());
61   }
62
63   return program_init_string;
64 }
65
66 char *getConfigProgramTitleString(void)
67 {
68   TreeInfo *graphics_current =
69     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
70
71   return (leveldir_current->program_title ?
72           leveldir_current->program_title :
73           graphics_current->program_title ?
74           graphics_current->program_title :
75           setup.internal.program_title);
76 }
77
78 char *getConfigProgramCopyrightString(void)
79 {
80   TreeInfo *graphics_current =
81     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
82
83   return (leveldir_current->program_copyright ?
84           leveldir_current->program_copyright :
85           graphics_current->program_copyright ?
86           graphics_current->program_copyright :
87           setup.internal.program_copyright);
88 }
89
90 char *getConfigProgramCompanyString(void)
91 {
92   TreeInfo *graphics_current =
93     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
94
95   return (leveldir_current->program_company ?
96           leveldir_current->program_company :
97           graphics_current->program_company ?
98           graphics_current->program_company :
99           setup.internal.program_company);
100 }
101
102 char *getWindowTitleString(void)
103 {
104   static char *window_title_string = NULL;
105
106   checked_free(window_title_string);
107
108 #ifdef DEBUG
109   window_title_string = checked_malloc(strlen(getProgramInitString()) + 20 +
110                                        strlen(getSourceDateString()) + 2 + 1);
111
112   if (setup.internal.show_scaling_in_title)
113     sprintf(window_title_string, "%s (%d %%) [%s]",
114             getProgramInitString(), video.window_scaling_percent,
115             getSourceDateString());
116   else
117     sprintf(window_title_string, "%s [%s]",
118             getProgramInitString(),
119             getSourceDateString());
120 #else
121   window_title_string = checked_malloc(strlen(getProgramInitString()) + 20);
122
123   if (setup.internal.show_scaling_in_title)
124     sprintf(window_title_string, "%s (%d %%)",
125             getProgramInitString(), video.window_scaling_percent);
126   else
127     sprintf(window_title_string, "%s",
128             getProgramInitString());
129 #endif
130
131   return window_title_string;
132 }