From: Holger Schemel Date: Tue, 29 Mar 2022 21:54:51 +0000 (+0200) Subject: added functions to get program info filename (not used yet) X-Git-Tag: 4.3.2.0~52 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b6b9bbe343c4238498a264ec0b3b5327fd3b22fb;p=rocksndiamonds.git added functions to get program info filename (not used yet) --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index ccbd2ed5..b78d274e 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -884,6 +884,34 @@ char *getCreditsFilename(int nr, boolean global) return NULL; // cannot find credits file } +static char *getProgramInfoBasename(int nr) +{ + static char basename[32]; + + sprintf(basename, "program_%d.txt", nr + 1); + + return basename; +} + +char *getProgramInfoFilename(int nr) +{ + char *basename = getProgramInfoBasename(nr); + static char *info_subdir = NULL; + static char *filename = NULL; + + if (info_subdir == NULL) + info_subdir = getPath2(DOCS_DIRECTORY, INFO_DIRECTORY); + + checked_free(filename); + + // look for program info file in the game's base directory + filename = getPath3(options.base_directory, info_subdir, basename); + if (fileExists(filename)) + return filename; + + return NULL; // cannot find program info file +} + static char *getCorrectedArtworkBasename(char *basename) { return basename; diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 69a9175e..4b2e65f6 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -280,6 +280,7 @@ char *getHelpTextFilename(void); char *getLevelSetInfoFilename(void); char *getLevelSetTitleMessageFilename(int, boolean); char *getCreditsFilename(int, boolean); +char *getProgramInfoFilename(int); char *getImageFilename(char *); char *getCustomImageFilename(char *); char *getCustomSoundFilename(char *); diff --git a/src/libgame/system.h b/src/libgame/system.h index 8c79f19d..7a80e91f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -656,6 +656,7 @@ #define DOCS_DIRECTORY "docs" #define ELEMENTS_DIRECTORY "elements" #define CREDITS_DIRECTORY "credits" +#define INFO_DIRECTORY "info" #define CACHE_DIRECTORY "cache" #define CONF_DIRECTORY "conf" #define NETWORK_DIRECTORY "network"