rnd-20100309-1-src
[rocksndiamonds.git] / src / config.c
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * config.c                                                 *
12 ***********************************************************/
13
14 #include "libgame/libgame.h"
15
16 #include "config.h"
17 #include "conftime.h"
18
19
20 #define USE_EXTENDED_VERSION    1
21
22
23 char *getCompileDateString()
24 {
25   return COMPILE_DATE_STRING;
26 }
27
28 char *getProgramReleaseVersionString()
29 {
30   static char program_version_string[32];
31
32 #if USE_EXTENDED_VERSION
33   sprintf(program_version_string, "%d.%d.%d.%d",
34           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH,
35           PROGRAM_VERSION_BUILD);
36 #else
37   sprintf(program_version_string, "%d.%d.%d",
38           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH);
39 #endif
40
41   return program_version_string;
42 }
43
44 char *getProgramFullVersionString()
45 {
46   static char program_version_string[32];
47
48 #if USE_EXTENDED_VERSION
49   sprintf(program_version_string, "%d.%d.%d.%d",
50           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH,
51           PROGRAM_VERSION_BUILD);
52 #else
53   sprintf(program_version_string, "%d.%d.%d-%d",
54           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH,
55           PROGRAM_VERSION_BUILD);
56 #endif
57
58   return program_version_string;
59 }
60
61 char *getProgramVersionString()
62 {
63 #ifdef DEBUG
64   return getProgramFullVersionString();
65 #else
66   return getProgramReleaseVersionString();
67 #endif
68 }
69
70 char *getProgramInitString()
71 {
72   static char *program_init_string = NULL;
73
74   if (program_init_string == NULL)
75   {
76     program_init_string = checked_malloc(strlen(PROGRAM_TITLE_STRING) + 1 +
77                                          strlen(getProgramVersionString()) +1 +
78                                          strlen(TARGET_STRING) + 1);
79
80     sprintf(program_init_string, "%s %s %s",
81             PROGRAM_TITLE_STRING, getProgramVersionString(), TARGET_STRING);
82   }
83
84   return program_init_string;
85 }
86
87 char *getWindowTitleString()
88 {
89 #ifdef DEBUG
90   static char *window_title_string = NULL;
91
92   if (window_title_string == NULL)
93   {
94     window_title_string = checked_malloc(strlen(getProgramInitString()) + 1 +
95                                          strlen(getCompileDateString()) + 2 +1);
96
97     sprintf(window_title_string, "%s [%s]",
98             getProgramInitString(), getCompileDateString());
99   }
100
101   return window_title_string;
102 #else
103   return getProgramInitString();
104 #endif
105 }