From: Holger Schemel Date: Fri, 14 May 2021 22:58:43 +0000 (+0200) Subject: changed variable and preprocessor definition names for game base directory X-Git-Tag: 4.3.0.0~146 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b8f3395f07c7a7c044384893c751f9b486d8f0d9;p=rocksndiamonds.git changed variable and preprocessor definition names for game base directory --- diff --git a/Makefile b/Makefile index 3e03456b..a9f14410 100644 --- a/Makefile +++ b/Makefile @@ -21,12 +21,12 @@ CC = gcc # (this must be set to "gmake" for some systems) MAKE = make -# directory for read-only game data (like graphics, sounds, levels) +# directory for (read-only) game data (like graphics, sounds, levels) # (this directory is usually the game's installation directory) # default is '.' to be able to run program without installation -# RO_GAME_DIR = . +# BASE_PATH = . # use the following setting for Debian / Ubuntu installations: -# RO_GAME_DIR = /usr/share/games/rocksndiamonds +# BASE_PATH = /usr/share/games/rocksndiamonds # uncomment if system has no joystick include file # JOYSTICK = -DNO_JOYSTICK diff --git a/src/Makefile b/src/Makefile index 5f57dd34..21ca5f95 100644 --- a/src/Makefile +++ b/src/Makefile @@ -114,11 +114,11 @@ endif # configuring compile-time definitions # ----------------------------------------------------------------------------- -ifdef RO_GAME_DIR # path to read-only game data specified -CONFIG_RO_GAME_DIR = -DRO_GAME_DIR="\"$(RO_GAME_DIR)\"" +ifdef BASE_PATH # path to read-only game data +CONFIG_BASE_PATH = -DBASE_PATH="\"$(BASE_PATH)\"" endif -CONFIG = $(CONFIG_RO_GAME_DIR) $(JOYSTICK) +CONFIG = $(CONFIG_BASE_PATH) $(JOYSTICK) DEBUG = -DDEBUG -g diff --git a/src/libgame/misc.c b/src/libgame/misc.c index a81f1553..ff64284e 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1240,7 +1240,7 @@ void GetOptions(int argc, char *argv[], void (*print_usage_function)(void), void (*print_version_function)(void)) { - char *ro_base_path = getProgramMainDataPath(argv[0], RO_BASE_PATH); + char *base_path = getProgramMainDataPath(argv[0], BASE_PATH); char **argvplus = checked_calloc((argc + 1) * sizeof(char **)); char **options_left = &argvplus[1]; @@ -1252,13 +1252,14 @@ void GetOptions(int argc, char *argv[], options.server_host = NULL; options.server_port = 0; - options.ro_base_directory = ro_base_path; - options.level_directory = getPath2(ro_base_path, LEVELS_DIRECTORY); - options.graphics_directory = getPath2(ro_base_path, GRAPHICS_DIRECTORY); - options.sounds_directory = getPath2(ro_base_path, SOUNDS_DIRECTORY); - options.music_directory = getPath2(ro_base_path, MUSIC_DIRECTORY); - options.docs_directory = getPath2(ro_base_path, DOCS_DIRECTORY); - options.conf_directory = getPath2(ro_base_path, CONF_DIRECTORY); + options.base_directory = base_path; + + options.level_directory = getPath2(base_path, LEVELS_DIRECTORY); + options.graphics_directory = getPath2(base_path, GRAPHICS_DIRECTORY); + options.sounds_directory = getPath2(base_path, SOUNDS_DIRECTORY); + options.music_directory = getPath2(base_path, MUSIC_DIRECTORY); + options.docs_directory = getPath2(base_path, DOCS_DIRECTORY); + options.conf_directory = getPath2(base_path, CONF_DIRECTORY); options.execute_command = NULL; options.special_flags = NULL; @@ -1332,17 +1333,17 @@ void GetOptions(int argc, char *argv[], if (option_arg == NULL) FailWithHelp("option '%s' requires an argument", option_str); - options.ro_base_directory = ro_base_path = getStringCopy(option_arg); + options.base_directory = base_path = getStringCopy(option_arg); if (option_arg == next_option) options_left++; // adjust paths for sub-directories in base directory accordingly - options.level_directory = getPath2(ro_base_path, LEVELS_DIRECTORY); - options.graphics_directory = getPath2(ro_base_path, GRAPHICS_DIRECTORY); - options.sounds_directory = getPath2(ro_base_path, SOUNDS_DIRECTORY); - options.music_directory = getPath2(ro_base_path, MUSIC_DIRECTORY); - options.docs_directory = getPath2(ro_base_path, DOCS_DIRECTORY); - options.conf_directory = getPath2(ro_base_path, CONF_DIRECTORY); + options.level_directory = getPath2(base_path, LEVELS_DIRECTORY); + options.graphics_directory = getPath2(base_path, GRAPHICS_DIRECTORY); + options.sounds_directory = getPath2(base_path, SOUNDS_DIRECTORY); + options.music_directory = getPath2(base_path, MUSIC_DIRECTORY); + options.docs_directory = getPath2(base_path, DOCS_DIRECTORY); + options.conf_directory = getPath2(base_path, CONF_DIRECTORY); } else if (strncmp(option, "-levels", option_len) == 0) { diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 37b7db12..4bbfba20 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -534,8 +534,8 @@ char *getProgramConfigFilename(char *command_filename) if (strSuffix(command_filename_1, ".exe")) command_filename_1[strlen(command_filename_1) - 4] = '\0'; - char *ro_base_path = getProgramMainDataPath(command_filename, RO_BASE_PATH); - char *conf_directory = getPath2(ro_base_path, CONF_DIRECTORY); + char *base_path = getProgramMainDataPath(command_filename, BASE_PATH); + char *conf_directory = getPath2(base_path, CONF_DIRECTORY); char *command_basepath = getBasePath(command_filename); char *command_basename = getBaseNameNoSuffix(command_filename); @@ -545,7 +545,7 @@ char *getProgramConfigFilename(char *command_filename) config_filename_2 = getStringCat2(command_filename_2, ".conf"); config_filename_3 = getPath2(conf_directory, SETUP_FILENAME); - checked_free(ro_base_path); + checked_free(base_path); checked_free(conf_directory); checked_free(command_basepath); diff --git a/src/libgame/system.h b/src/libgame/system.h index e93122a8..a02459d8 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -624,13 +624,11 @@ // default value for off-screen positions #define POS_OFFSCREEN (-1000000) -// definitions for game sub-directories -#ifndef RO_GAME_DIR -#define RO_GAME_DIR "." +// definitions for game base path and sub-directories +#ifndef BASE_PATH +#define BASE_PATH "." #endif -#define RO_BASE_PATH RO_GAME_DIR - // directory names #define GRAPHICS_DIRECTORY "graphics" #define SOUNDS_DIRECTORY "sounds" @@ -1040,7 +1038,7 @@ struct OptionInfo char *server_host; int server_port; - char *ro_base_directory; + char *base_directory; char *level_directory; char *graphics_directory; char *sounds_directory;