rnd-20040301-1-src
[rocksndiamonds.git] / src / config.c
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 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 char *getProgramVersionString()
21 {
22   static char program_version_string[32];
23
24 #ifdef DEBUG
25   sprintf(program_version_string, "%d.%d.%d-%d",
26           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH,
27           PROGRAM_VERSION_BUILD);
28 #else
29   sprintf(program_version_string, "%d.%d.%d",
30           PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH);
31 #endif
32
33   return program_version_string;
34 }
35
36 char *getProgramInitString()
37 {
38   static char *program_init_string = NULL;
39
40   if (program_init_string == NULL)
41   {
42     program_init_string = checked_malloc(strlen(PROGRAM_TITLE_STRING) + 1 +
43                                          strlen(getProgramVersionString()) +1 +
44                                          strlen(TARGET_STRING) + 1);
45
46     sprintf(program_init_string, "%s %s %s",
47             PROGRAM_TITLE_STRING, getProgramVersionString(), TARGET_STRING);
48   }
49
50   return program_init_string;
51 }
52
53 char *getWindowTitleString()
54 {
55 #ifdef DEBUG
56   static char *window_title_string = NULL;
57
58   if (window_title_string == NULL)
59   {
60     window_title_string = checked_malloc(strlen(getProgramInitString()) + 1 +
61                                          strlen(COMPILE_DATE_STRING) + 1);
62
63     sprintf(window_title_string, "%s %s",
64             getProgramInitString(), COMPILE_DATE_STRING);
65   }
66
67   return window_title_string;
68 #else
69   return getProgramInitString();
70 #endif
71 }