rnd-20070302-1-src
authorHolger Schemel <info@artsoft.org>
Fri, 2 Mar 2007 00:33:35 +0000 (01:33 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:39 +0000 (10:54 +0200)
* added new (special) "include: <filename>" directive that works in all
  configuration files (like "graphicsinfo.conf") and that has the same
  effect as if that directive would be replaced with the content of the
  specified file (this can be useful to split large configuration files
  into several smaller ones and include them from one main file, or to
  store configuration settings that always stay the same into a separate
  file, while including it and only add those parts that really change)

14 files changed:
ChangeLog
src/conftime.h
src/engines.h
src/files.c
src/game.c
src/game_em/graphics.c
src/init.c
src/libgame/image.c
src/libgame/misc.c
src/libgame/misc.h
src/libgame/setup.c
src/libgame/sound.c
src/network.c
src/tools.c

index 0813cd6a4dc0278b68bb6a0eadb71ab23ea141e6..51a8c9ff84391db81e16554b3a22e67b0eda565c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-03-01
+       * added new (special) "include: <filename>" directive that works in all
+         configuration files (like "graphicsinfo.conf") and that has the same
+         effect as if that directive would be replaced with the content of the
+         specified file (this can be useful to split large configuration files
+         into several smaller ones and include them from one main file, or to
+         store configuration settings that always stay the same into a separate
+         file, while including it and only add those parts that really change)
+
 2007-02-24
        * fixed minor bug (screen redraw of player tiles) in EMC graphics engine
 
 2007-02-24
        * fixed minor bug (screen redraw of player tiles) in EMC graphics engine
 
index 59a6e932c3ff3f836f87a4a86a9d2838db6de45b..f1b3d9f646c46e8d4dae3bcd7c5cc87a99daf234 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-02-26 02:31"
+#define COMPILE_DATE_STRING "2007-03-02 00:13"
index 02061f7950bbd12259a483205895b3e1f99065e4..9354c65292dcb591878a6a6671b134269916e9a4 100644 (file)
@@ -33,7 +33,7 @@ extern int getGameFrameDelay_EM(int);
 extern void PlayLevelSound_EM(int, int, int, int);
 extern void InitGraphicInfo_EM(void);
 
 extern void PlayLevelSound_EM(int, int, int, int);
 extern void InitGraphicInfo_EM(void);
 
-void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *);
+void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *, int, int);
 void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *);
 
 #endif /* ENGINES_H */
 void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *);
 
 #endif /* ENGINES_H */
index 7c35c2359b8183c4526bfa0ab669912d426a4d8a..60782f76520d2c2ea511dcd695be2590ff84c85c 100644 (file)
@@ -8453,19 +8453,19 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
     {
       if (num_unknown_tokens == 0)
       {
     {
       if (num_unknown_tokens == 0)
       {
-       Error(ERR_RETURN_LINE, "-");
-       Error(ERR_RETURN, "warning: unknown token(s) found in config file:");
-       Error(ERR_RETURN, "- config file: '%s'", filename);
+       Error(ERR_INFO_LINE, "-");
+       Error(ERR_INFO, "warning: unknown token(s) found in config file:");
+       Error(ERR_INFO, "- config file: '%s'", filename);
 
        num_unknown_tokens++;
       }
 
 
        num_unknown_tokens++;
       }
 
-      Error(ERR_RETURN, "- token: '%s'", list->token);
+      Error(ERR_INFO, "- token: '%s'", list->token);
     }
   }
 
   if (num_unknown_tokens > 0)
     }
   }
 
   if (num_unknown_tokens > 0)
-    Error(ERR_RETURN_LINE, "-");
+    Error(ERR_INFO_LINE, "-");
 
   while (*num_elements % 4)    /* pad with empty elements, if needed */
     (*elements)[(*num_elements)++] = EL_EMPTY;
 
   while (*num_elements % 4)    /* pad with empty elements, if needed */
     (*elements)[(*num_elements)++] = EL_EMPTY;
@@ -8766,18 +8766,18 @@ void print_unknown_token(char *filename, char *token, int token_nr)
 {
   if (token_nr == 0)
   {
 {
   if (token_nr == 0)
   {
-    Error(ERR_RETURN_LINE, "-");
-    Error(ERR_RETURN, "warning: unknown token(s) found in config file:");
-    Error(ERR_RETURN, "- config file: '%s'", filename);
+    Error(ERR_INFO_LINE, "-");
+    Error(ERR_INFO, "warning: unknown token(s) found in config file:");
+    Error(ERR_INFO, "- config file: '%s'", filename);
   }
 
   }
 
-  Error(ERR_RETURN, "- token: '%s'", token);
+  Error(ERR_INFO, "- token: '%s'", token);
 }
 
 void print_unknown_token_end(int token_nr)
 {
   if (token_nr > 0)
 }
 
 void print_unknown_token_end(int token_nr)
 {
   if (token_nr > 0)
-    Error(ERR_RETURN_LINE, "-");
+    Error(ERR_INFO_LINE, "-");
 }
 
 void LoadHelpAnimInfo()
 }
 
 void LoadHelpAnimInfo()
index 237395e75ee33699d5647763f146b3a39d04323b..afa0f24f923f9cbcccfbe3ebcac1872545fe2b55 100644 (file)
@@ -13536,9 +13536,9 @@ static void LoadEngineSnapshotValues_RND()
 
   if (game.num_random_calls != num_random_calls)
   {
 
   if (game.num_random_calls != num_random_calls)
   {
-    Error(ERR_RETURN, "number of random calls out of sync");
-    Error(ERR_RETURN, "number of random calls should be %d", num_random_calls);
-    Error(ERR_RETURN, "number of random calls is %d", game.num_random_calls);
+    Error(ERR_INFO, "number of random calls out of sync");
+    Error(ERR_INFO, "number of random calls should be %d", num_random_calls);
+    Error(ERR_INFO, "number of random calls is %d", game.num_random_calls);
     Error(ERR_EXIT, "this should not happen -- please debug");
   }
 }
     Error(ERR_EXIT, "this should not happen -- please debug");
   }
 }
index 2d8188f188320850fb6b63bd19972445ee841de8..fed6bcdf4616603627200a27f6f1f23bb279726f 100644 (file)
@@ -150,7 +150,8 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy,
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
 
 #if 1
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
 
 #if 1
-  getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y);
+  getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y,
+                              x - 2, y - 2);
 #endif
 
   int src_x = g->src_x + g->src_offset_x;
 #endif
 
   int src_x = g->src_x + g->src_offset_x;
index 0521c3b7d5b3852e5d2ae4ade8c3589b7b6ea622..4e715dff4ab4c80abc3e19cc4cfc1cf35d6c9ab7 100644 (file)
@@ -815,7 +815,7 @@ void InitElementGraphicInfo()
     for (i = 0; i < MAX_NUM_ELEMENTS; i++)
       if (element_info[i].graphic[ACTION_DEFAULT] == IMG_UNKNOWN &&
          i != EL_UNKNOWN)
     for (i = 0; i < MAX_NUM_ELEMENTS; i++)
       if (element_info[i].graphic[ACTION_DEFAULT] == IMG_UNKNOWN &&
          i != EL_UNKNOWN)
-       Error(ERR_RETURN, "warning: no graphic for element '%s' (%d)",
+       Error(ERR_INFO, "warning: no graphic for element '%s' (%d)",
              element_info[i].token_name, i);
   }
 #endif
              element_info[i].token_name, i);
   }
 #endif
@@ -1192,18 +1192,18 @@ static void set_cloned_graphic_parameters(int graphic)
 
   if (num_references_followed >= max_num_images)
   {
 
   if (num_references_followed >= max_num_images)
   {
-    Error(ERR_RETURN_LINE, "-");
-    Error(ERR_RETURN, "warning: error found in config file:");
-    Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
-    Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(graphic));
-    Error(ERR_RETURN, "error: loop discovered when resolving cloned graphics");
-    Error(ERR_RETURN, "custom graphic rejected for this element/action");
+    Error(ERR_INFO_LINE, "-");
+    Error(ERR_INFO, "warning: error found in config file:");
+    Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
+    Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(graphic));
+    Error(ERR_INFO, "error: loop discovered when resolving cloned graphics");
+    Error(ERR_INFO, "custom graphic rejected for this element/action");
 
     if (graphic == fallback_graphic)
       Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
 
     if (graphic == fallback_graphic)
       Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
-    Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
-    Error(ERR_RETURN_LINE, "-");
+    Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
+    Error(ERR_INFO_LINE, "-");
 
     graphic_info[graphic] = graphic_info[fallback_graphic];
   }
 
     graphic_info[graphic] = graphic_info[fallback_graphic];
   }
@@ -1344,21 +1344,21 @@ static void InitGraphicInfo()
        src_x + width  > src_bitmap_width ||
        src_y + height > src_bitmap_height)
     {
        src_x + width  > src_bitmap_width ||
        src_y + height > src_bitmap_height)
     {
-      Error(ERR_RETURN_LINE, "-");
-      Error(ERR_RETURN, "warning: error found in config file:");
-      Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
-      Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i));
-      Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename);
-      Error(ERR_RETURN,
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: error found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
+      Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i));
+      Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename);
+      Error(ERR_INFO,
            "error: first animation frame out of bounds (%d, %d) [%d, %d]",
            src_x, src_y, src_bitmap_width, src_bitmap_height);
            "error: first animation frame out of bounds (%d, %d) [%d, %d]",
            src_x, src_y, src_bitmap_width, src_bitmap_height);
-      Error(ERR_RETURN, "custom graphic rejected for this element/action");
+      Error(ERR_INFO, "custom graphic rejected for this element/action");
 
       if (i == fallback_graphic)
        Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
 
       if (i == fallback_graphic)
        Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
-      Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
-      Error(ERR_RETURN_LINE, "-");
+      Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
+      Error(ERR_INFO_LINE, "-");
 
       graphic_info[i] = graphic_info[fallback_graphic];
     }
 
       graphic_info[i] = graphic_info[fallback_graphic];
     }
@@ -1372,21 +1372,21 @@ static void InitGraphicInfo()
        src_x + width  > src_bitmap_width ||
        src_y + height > src_bitmap_height)
     {
        src_x + width  > src_bitmap_width ||
        src_y + height > src_bitmap_height)
     {
-      Error(ERR_RETURN_LINE, "-");
-      Error(ERR_RETURN, "warning: error found in config file:");
-      Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
-      Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i));
-      Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename);
-      Error(ERR_RETURN,
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: error found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
+      Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i));
+      Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename);
+      Error(ERR_INFO,
            "error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
            last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
            "error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
            last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
-      Error(ERR_RETURN, "custom graphic rejected for this element/action");
+      Error(ERR_INFO, "custom graphic rejected for this element/action");
 
       if (i == fallback_graphic)
        Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
 
       if (i == fallback_graphic)
        Error(ERR_EXIT, "fatal error: no fallback graphic available");
 
-      Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
-      Error(ERR_RETURN_LINE, "-");
+      Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
+      Error(ERR_INFO_LINE, "-");
 
       graphic_info[i] = graphic_info[fallback_graphic];
     }
 
       graphic_info[i] = graphic_info[fallback_graphic];
     }
index 6cfa44f4d0a1f11463a71a928138afda63374968..85a73a54f2a29322acb80ce9e4b9fab4f779ebd7 100644 (file)
@@ -385,7 +385,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual,
          if (!private_cmap)
          {
            if (options.verbose)
          if (!private_cmap)
          {
            if (options.verbose)
-             Error(ERR_RETURN, "switching to private colormap");
+             Error(ERR_INFO, "switching to private colormap");
 
            /* we just filled up the default colormap -- get a private one
               which contains all already allocated colors */
 
            /* we just filled up the default colormap -- get a private one
               which contains all already allocated colors */
@@ -486,7 +486,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual,
       break;
   
     default:
       break;
   
     default:
-      Error(ERR_RETURN,"DirectColor, TrueColor or PseudoColor display needed");
+      Error(ERR_INFO,"DirectColor, TrueColor or PseudoColor display needed");
       SetError(error, "display class not supported");
 
       return NULL;
       SetError(error, "display class not supported");
 
       return NULL;
@@ -560,7 +560,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual,
        }
 
         default:
        }
 
         default:
-         Error(ERR_RETURN, "RGB or TrueColor image needed");
+         Error(ERR_INFO, "RGB or TrueColor image needed");
          SetError(error, "image type not supported");
 
          return NULL;
          SetError(error, "image type not supported");
 
          return NULL;
@@ -594,7 +594,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual,
     }
 
     default:
     }
 
     default:
-      Error(ERR_RETURN,"DirectColor, TrueColor or PseudoColor display needed");
+      Error(ERR_INFO,"DirectColor, TrueColor or PseudoColor display needed");
       SetError(error, "display class not supported");
 
       return NULL;
       SetError(error, "display class not supported");
 
       return NULL;
index 88d2e299409024e5eb76c2fa66ecbd4c0b1b57d9..41b68190559a73a7eae920ee3e1a472000197120 100644 (file)
@@ -808,7 +808,7 @@ void Error(int mode, char *format, ...)
   if (mode & ERR_WARN && !options.verbose)
     return;
 
   if (mode & ERR_WARN && !options.verbose)
     return;
 
-  if (mode == ERR_RETURN_LINE)
+  if (mode == ERR_INFO_LINE)
   {
     if (!last_line_was_separator)
       fprintf_line(program.error_file, format, 79);
   {
     if (!last_line_was_separator)
       fprintf_line(program.error_file, format, 79);
@@ -1966,7 +1966,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
          !strEqual(&config_list[i].value[len_config_value - 4], ".wav") &&
          !strEqual(config_list[i].value, UNDEFINED_FILENAME))
       {
          !strEqual(&config_list[i].value[len_config_value - 4], ".wav") &&
          !strEqual(config_list[i].value, UNDEFINED_FILENAME))
       {
-       Error(ERR_RETURN, "Configuration directive '%s' -> '%s':",
+       Error(ERR_INFO, "Configuration directive '%s' -> '%s':",
              config_list[i].token, config_list[i].value);
        Error(ERR_EXIT, "This seems to be no valid definition -- please fix");
       }
              config_list[i].token, config_list[i].value);
        Error(ERR_EXIT, "This seems to be no valid definition -- please fix");
       }
@@ -1983,11 +1983,11 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
   num_file_list_entries_found = list_pos + 1;
   if (num_file_list_entries_found != num_file_list_entries)
   {
   num_file_list_entries_found = list_pos + 1;
   if (num_file_list_entries_found != num_file_list_entries)
   {
-    Error(ERR_RETURN_LINE, "-");
-    Error(ERR_RETURN, "inconsistant config list information:");
-    Error(ERR_RETURN, "- should be:   %d (according to 'src/conf_xxx.h')",
+    Error(ERR_INFO_LINE, "-");
+    Error(ERR_INFO, "inconsistant config list information:");
+    Error(ERR_INFO, "- should be:   %d (according to 'src/conf_xxx.h')",
          num_file_list_entries);
          num_file_list_entries);
-    Error(ERR_RETURN, "- found to be: %d (according to 'src/conf_xxx.c')",
+    Error(ERR_INFO, "- found to be: %d (according to 'src/conf_xxx.c')",
          num_file_list_entries_found);
     Error(ERR_EXIT,   "please fix");
   }
          num_file_list_entries_found);
     Error(ERR_EXIT,   "please fix");
   }
@@ -2431,53 +2431,53 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info,
 
     if (options.debug && dynamic_tokens_found)
     {
 
     if (options.debug && dynamic_tokens_found)
     {
-      Error(ERR_RETURN_LINE, "-");
-      Error(ERR_RETURN, "dynamic token(s) found in config file:");
-      Error(ERR_RETURN, "- config file: '%s'", filename);
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "dynamic token(s) found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", filename);
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(extra_file_hash, list->token);
 
        if (value != NULL && strEqual(value, known_token_value))
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(extra_file_hash, list->token);
 
        if (value != NULL && strEqual(value, known_token_value))
-         Error(ERR_RETURN, "- dynamic token: '%s'", list->token);
+         Error(ERR_INFO, "- dynamic token: '%s'", list->token);
       }
 
       }
 
-      Error(ERR_RETURN_LINE, "-");
+      Error(ERR_INFO_LINE, "-");
     }
 
     if (unknown_tokens_found)
     {
     }
 
     if (unknown_tokens_found)
     {
-      Error(ERR_RETURN_LINE, "-");
-      Error(ERR_RETURN, "warning: unknown token(s) found in config file:");
-      Error(ERR_RETURN, "- config file: '%s'", filename);
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: unknown token(s) found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", filename);
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(extra_file_hash, list->token);
 
        if (value != NULL && !strEqual(value, known_token_value))
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(extra_file_hash, list->token);
 
        if (value != NULL && !strEqual(value, known_token_value))
-         Error(ERR_RETURN, "- dynamic token: '%s'", list->token);
+         Error(ERR_INFO, "- dynamic token: '%s'", list->token);
       }
 
       }
 
-      Error(ERR_RETURN_LINE, "-");
+      Error(ERR_INFO_LINE, "-");
     }
 
     if (undefined_values_found)
     {
     }
 
     if (undefined_values_found)
     {
-      Error(ERR_RETURN_LINE, "-");
-      Error(ERR_RETURN, "warning: undefined values found in config file:");
-      Error(ERR_RETURN, "- config file: '%s'", filename);
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: undefined values found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", filename);
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(empty_file_hash, list->token);
 
        if (value != NULL)
 
       for (list = setup_file_list; list != NULL; list = list->next)
       {
        char *value = getHashEntry(empty_file_hash, list->token);
 
        if (value != NULL)
-         Error(ERR_RETURN, "- undefined value for token: '%s'", list->token);
+         Error(ERR_INFO, "- undefined value for token: '%s'", list->token);
       }
 
       }
 
-      Error(ERR_RETURN_LINE, "-");
+      Error(ERR_INFO_LINE, "-");
     }
 
     freeSetupFileList(setup_file_list);
     }
 
     freeSetupFileList(setup_file_list);
index 9a5e9186c47ed03dfc40d2242f09badfa3bc4d70..ab47b2b35bba0bfee71377faf2fd18c628063187 100644 (file)
@@ -36,8 +36,8 @@
 #define GetSimpleRandom(max)           get_random_number(RANDOM_SIMPLE, max)
 
 /* values for Error() */
 #define GetSimpleRandom(max)           get_random_number(RANDOM_SIMPLE, max)
 
 /* values for Error() */
-#define ERR_RETURN                     0
-#define ERR_RETURN_LINE                        (1 << 0)
+#define ERR_INFO                       0
+#define ERR_INFO_LINE                  (1 << 0)
 #define ERR_WARN                       (1 << 1)
 #define ERR_EXIT                       (1 << 2)
 #define ERR_HELP                       (1 << 3)
 #define ERR_WARN                       (1 << 1)
 #define ERR_EXIT                       (1 << 2)
 #define ERR_HELP                       (1 << 3)
index 75db82ef71b122fec9b4fb322d7b9efd4b736eb1..922f8314aa1689dd47c52eea6af5dd96f2f84211 100644 (file)
@@ -1610,11 +1610,13 @@ static void printSetupFileHash(SetupFileHash *hash)
 #define ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE           1
 #define CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING           0
 
 #define ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE           1
 #define CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING           0
 
-static void *loadSetupFileData(char *filename, boolean use_hash)
+static void loadSetupFileData(void *setup_file_data, char *filename,
+                             boolean top_recursion_level, boolean is_hash)
 {
 {
+  static SetupFileHash *include_filename_hash = NULL;
   char line[MAX_LINE_LEN], line_raw[MAX_LINE_LEN], previous_line[MAX_LINE_LEN];
   char *token, *value, *line_ptr;
   char line[MAX_LINE_LEN], line_raw[MAX_LINE_LEN], previous_line[MAX_LINE_LEN];
   char *token, *value, *line_ptr;
-  void *setup_file_data, *insert_ptr = NULL;
+  void *insert_ptr = NULL;
   boolean read_continued_line = FALSE;
   boolean token_value_separator_found;
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
   boolean read_continued_line = FALSE;
   boolean token_value_separator_found;
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
@@ -1622,18 +1624,25 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
 #endif
   FILE *file;
   int line_nr = 0;
 #endif
   FILE *file;
   int line_nr = 0;
+  int token_count = 0;
 
   if (!(file = fopen(filename, MODE_READ)))
   {
     Error(ERR_WARN, "cannot open configuration file '%s'", filename);
 
 
   if (!(file = fopen(filename, MODE_READ)))
   {
     Error(ERR_WARN, "cannot open configuration file '%s'", filename);
 
-    return NULL;
+    return;
   }
 
   }
 
-  if (use_hash)
-    setup_file_data = newSetupFileHash();
-  else
-    insert_ptr = setup_file_data = newSetupFileList("", "");
+  /* use "insert pointer" to store list end for constant insertion complexity */
+  if (!is_hash)
+    insert_ptr = setup_file_data;
+
+  /* on top invocation, create hash to mark included files (to prevent loops) */
+  if (top_recursion_level)
+    include_filename_hash = newSetupFileHash();
+
+  /* mark this file as already included (to prevent including it again) */
+  setHashEntry(include_filename_hash, getBaseNamePtr(filename), "true");
 
   while (!feof(file))
   {
 
   while (!feof(file))
   {
@@ -1750,14 +1759,14 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
       {
        if (!token_value_separator_warning)
        {
       {
        if (!token_value_separator_warning)
        {
-         Error(ERR_RETURN_LINE, "-");
+         Error(ERR_INFO_LINE, "-");
          Error(ERR_WARN, "missing token/value separator(s) in config file:");
          Error(ERR_WARN, "missing token/value separator(s) in config file:");
-         Error(ERR_RETURN, "- config file: '%s'", filename);
+         Error(ERR_INFO, "- config file: '%s'", filename);
 
          token_value_separator_warning = TRUE;
        }
 
 
          token_value_separator_warning = TRUE;
        }
 
-       Error(ERR_RETURN, "- line %d: '%s'", line_nr, line_raw);
+       Error(ERR_INFO, "- line %d: '%s'", line_nr, line_raw);
       }
 #endif
     }
       }
 #endif
     }
@@ -1780,10 +1789,38 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
 
     if (*token)
     {
 
     if (*token)
     {
-      if (use_hash)
-       setHashEntry((SetupFileHash *)setup_file_data, token, value);
+      if (strEqual(token, "include"))
+      {
+       if (getHashEntry(include_filename_hash, value) == NULL)
+       {
+         char *basepath = getBasePath(filename);
+         char *basename = getBaseName(value);
+         char *filename_include = getPath2(basepath, basename);
+
+#if 0
+         Error(ERR_INFO, "[including file '%s']", filename_include);
+#endif
+
+         loadSetupFileData(setup_file_data, filename_include, FALSE, is_hash);
+
+         free(basepath);
+         free(basename);
+         free(filename_include);
+       }
+       else
+       {
+         Error(ERR_WARN, "ignoring already processed file '%s'", value);
+       }
+      }
       else
       else
-       insert_ptr = addListEntry((SetupFileList *)insert_ptr, token, value);
+      {
+       if (is_hash)
+         setHashEntry((SetupFileHash *)setup_file_data, token, value);
+       else
+         insert_ptr = addListEntry((SetupFileList *)insert_ptr, token, value);
+
+       token_count++;
+      }
     }
   }
 
     }
   }
 
@@ -1791,29 +1828,14 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
 
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
   if (token_value_separator_warning)
 
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
   if (token_value_separator_warning)
-    Error(ERR_RETURN_LINE, "-");
+    Error(ERR_INFO_LINE, "-");
 #endif
 
 #endif
 
-  if (use_hash)
-  {
-    if (hashtable_count((SetupFileHash *)setup_file_data) == 0)
-      Error(ERR_WARN, "configuration file '%s' is empty", filename);
-  }
-  else
-  {
-    SetupFileList *setup_file_list = (SetupFileList *)setup_file_data;
-    SetupFileList *first_valid_list_entry = setup_file_list->next;
-
-    /* free empty list header */
-    setup_file_list->next = NULL;
-    freeSetupFileList(setup_file_list);
-    setup_file_data = first_valid_list_entry;
+  if (token_count == 0)
+    Error(ERR_WARN, "configuration file '%s' is empty", filename);
 
 
-    if (first_valid_list_entry == NULL)
-      Error(ERR_WARN, "configuration file '%s' is empty", filename);
-  }
-
-  return setup_file_data;
+  if (top_recursion_level)
+    freeSetupFileHash(include_filename_hash);
 }
 
 void saveSetupFileHash(SetupFileHash *hash, char *filename)
 }
 
 void saveSetupFileHash(SetupFileHash *hash, char *filename)
@@ -1839,12 +1861,27 @@ void saveSetupFileHash(SetupFileHash *hash, char *filename)
 
 SetupFileList *loadSetupFileList(char *filename)
 {
 
 SetupFileList *loadSetupFileList(char *filename)
 {
-  return (SetupFileList *)loadSetupFileData(filename, FALSE);
+  SetupFileList *setup_file_list = newSetupFileList("", "");
+  SetupFileList *first_valid_list_entry;
+
+  loadSetupFileData(setup_file_list, filename, TRUE, FALSE);
+
+  first_valid_list_entry = setup_file_list->next;
+
+  /* free empty list header */
+  setup_file_list->next = NULL;
+  freeSetupFileList(setup_file_list);
+
+  return first_valid_list_entry;
 }
 
 SetupFileHash *loadSetupFileHash(char *filename)
 {
 }
 
 SetupFileHash *loadSetupFileHash(char *filename)
 {
-  return (SetupFileHash *)loadSetupFileData(filename, TRUE);
+  SetupFileHash *setup_file_hash = newSetupFileHash();
+
+  loadSetupFileData(setup_file_hash, filename, TRUE, TRUE);
+
+  return setup_file_hash;
 }
 
 void checkSetupFileHashIdentifier(SetupFileHash *setup_file_hash,
 }
 
 void checkSetupFileHashIdentifier(SetupFileHash *setup_file_hash,
index a01ce29dc1565f8b72592caa42fc009563af6d77..51b62efc7a5572a24176b56f31f2a8d0d1eaadcd 100644 (file)
@@ -913,8 +913,8 @@ static void Mixer_InsertSound(SoundControl snd_ctrl)
     {
       if (!mixer[i].active)
       {
     {
       if (!mixer[i].active)
       {
-       Error(ERR_RETURN, "Mixer_InsertSound: Channel %d inactive", i);
-       Error(ERR_RETURN, "Mixer_InsertSound: This should never happen!");
+       Error(ERR_INFO, "Mixer_InsertSound: Channel %d inactive", i);
+       Error(ERR_INFO, "Mixer_InsertSound: This should never happen!");
 
        mixer_active_channels--;
       }
 
        mixer_active_channels--;
       }
@@ -933,7 +933,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl)
     /* print some debugging information about audio channel usage */
     for (i = audio.first_sound_channel; i < audio.num_channels; i++)
     {
     /* print some debugging information about audio channel usage */
     for (i = audio.first_sound_channel; i < audio.num_channels; i++)
     {
-      Error(ERR_RETURN, "Mixer_InsertSound: %d [%d]: %ld (%ld)",
+      Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %ld (%ld)",
            i, mixer[i].active, mixer[i].data_len, (long)mixer[i].data_ptr);
     }
 #endif
            i, mixer[i].active, mixer[i].data_len, (long)mixer[i].data_ptr);
     }
 #endif
index f2f1ea2829427fb807d0d04e945e9d5ba7d1a8af..1a0feda699008b9eaf90d9b937f7ed447e8f2f49 100644 (file)
@@ -592,10 +592,10 @@ static void Handle_OP_MOVE_PLAYER(unsigned int len)
 
   if (server_frame_counter != FrameCounter)
   {
 
   if (server_frame_counter != FrameCounter)
   {
-    Error(ERR_RETURN, "client and servers frame counters out of sync");
-    Error(ERR_RETURN, "frame counter of client is %d", FrameCounter);
-    Error(ERR_RETURN, "frame counter of server is %d", server_frame_counter);
-    Error(ERR_RETURN, "this should not happen -- please debug");
+    Error(ERR_INFO, "client and servers frame counters out of sync");
+    Error(ERR_INFO, "frame counter of client is %d", FrameCounter);
+    Error(ERR_INFO, "frame counter of server is %d", server_frame_counter);
+    Error(ERR_INFO, "this should not happen -- please debug");
 
     stop_network_game = TRUE;
 
 
     stop_network_game = TRUE;
 
index f730529956853b6397486378f7b5f956c80017d3..3f9b7f26bdc436ee1e899dd8020eb7b3e67f5b62 100644 (file)
@@ -5736,7 +5736,8 @@ void ResetGfxAnimation_EM(int x, int y, int tile)
 }
 
 void getGraphicSourceObjectExt_EM(int tile, int frame_em,
 }
 
 void getGraphicSourceObjectExt_EM(int tile, int frame_em,
-                                 Bitmap **src_bitmap, int *src_x, int *src_y)
+                                 Bitmap **src_bitmap, int *src_x, int *src_y,
+                                 int x, int y)
 {
   int element         = object_mapping[tile].element_rnd;
   int action          = object_mapping[tile].action;
 {
   int element         = object_mapping[tile].element_rnd;
   int action          = object_mapping[tile].action;
@@ -5760,6 +5761,8 @@ void getGraphicSourceObjectExt_EM(int tile, int frame_em,
   else
     sync_frame = 7 - frame_em;
 
   else
     sync_frame = 7 - frame_em;
 
+  SetRandomAnimationValue(x, y);
+
   int frame = getAnimationFrame(g->anim_frames,
                                g->anim_delay,
                                g->anim_mode,
   int frame = getAnimationFrame(g->anim_frames,
                                g->anim_delay,
                                g->anim_mode,