changed variable and preprocessor definition names for game base directory
authorHolger Schemel <info@artsoft.org>
Fri, 14 May 2021 22:58:43 +0000 (00:58 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 14 May 2021 22:58:43 +0000 (00:58 +0200)
Makefile
src/Makefile
src/libgame/misc.c
src/libgame/setup.c
src/libgame/system.h

index 3e03456bb89f7c0ffe20260e2dc1d7716820adfd..a9f144109410636cde3941b9fc1764a8a99ba590 100644 (file)
--- 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
index 5f57dd34f0a2825547463c8a568b83322456bbb9..21ca5f9534648dbb977c5a93c38c9191a11bb3fe 100644 (file)
@@ -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
 
index a81f15532538efaa163fb591c1261108fc7dd53c..ff64284eee2061a52b267666418b1a95d63100c5 100644 (file)
@@ -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)
     {
index 37b7db1214cf19b8acc6bdc2b233c7dbb1561e4f..4bbfba2018fd085a60ee8753c4966f66208182c3 100644 (file)
@@ -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);
index e93122a8099b33d9daf44d567e7faf2020ff7227..a02459d8a01f7eb472ad75adb0af8defe8c450e0 100644 (file)
 // 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;