rnd-20091211-1-src
[rocksndiamonds.git] / src / libgame / setup.c
index d69c6537e238a42b925e202751fe558bf0216e2d..9e35b4dbe240b10e2ab93b8aaf7fc5b6c88429de 100644 (file)
@@ -334,7 +334,9 @@ char *setLevelArtworkDir(TreeInfo *ti)
   checked_free(*artwork_path_ptr);
 
   if ((level_artwork = getTreeInfoFromIdentifier(ti, *artwork_set_ptr)))
+  {
     *artwork_path_ptr = getStringCopy(getSetupArtworkDir(level_artwork));
+  }
   else
   {
     /*
@@ -670,10 +672,8 @@ char *getCustomImageFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
-  /* !!! INSERT WARNING HERE TO REPORT MISSING ARTWORK FILES !!! */
-#if 0
-  printf("::: MISSING ARTWORK FILE '%s'\n", basename);
-#endif
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
 
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
@@ -743,6 +743,9 @@ char *getCustomSoundFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
+
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
   filename = getPath2(options.sounds_directory, SND_FALLBACK_FILENAME);
@@ -811,6 +814,9 @@ char *getCustomMusicFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
+
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
   filename = getPath2(options.music_directory, MUS_FALLBACK_FILENAME);
@@ -2369,10 +2375,11 @@ void checkSetupFileHashIdentifier(SetupFileHash *setup_file_hash,
 #define LEVELINFO_TOKEN_MUSIC_SET              18
 #define LEVELINFO_TOKEN_FILENAME               19
 #define LEVELINFO_TOKEN_FILETYPE               20
-#define LEVELINFO_TOKEN_HANDICAP               21
-#define LEVELINFO_TOKEN_SKIP_LEVELS            22
+#define LEVELINFO_TOKEN_SPECIAL_FLAGS          21
+#define LEVELINFO_TOKEN_HANDICAP               22
+#define LEVELINFO_TOKEN_SKIP_LEVELS            23
 
-#define NUM_LEVELINFO_TOKENS                   23
+#define NUM_LEVELINFO_TOKENS                   24
 
 static LevelDirTree ldi;
 
@@ -2400,6 +2407,7 @@ static struct TokenInfo levelinfo_tokens[] =
   { TYPE_STRING,       &ldi.music_set,         "music_set"             },
   { TYPE_STRING,       &ldi.level_filename,    "filename"              },
   { TYPE_STRING,       &ldi.level_filetype,    "filetype"              },
+  { TYPE_STRING,       &ldi.special_flags,     "special_flags"         },
   { TYPE_BOOLEAN,      &ldi.handicap,          "handicap"              },
   { TYPE_BOOLEAN,      &ldi.skip_levels,       "skip_levels"           }
 };
@@ -2476,6 +2484,8 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type)
     ti->level_filename = NULL;
     ti->level_filetype = NULL;
 
+    ti->special_flags = NULL;
+
     ti->levels = 0;
     ti->first_level = 0;
     ti->last_level = 0;
@@ -2547,6 +2557,8 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent)
     ti->level_filename = NULL;
     ti->level_filetype = NULL;
 
+    ti->special_flags = getStringCopy(parent->special_flags);
+
     ti->levels = 0;
     ti->first_level = 0;
     ti->last_level = 0;
@@ -2598,6 +2610,8 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti)
   ti_copy->level_filename      = getStringCopy(ti->level_filename);
   ti_copy->level_filetype      = getStringCopy(ti->level_filetype);
 
+  ti_copy->special_flags       = getStringCopy(ti->special_flags);
+
   ti_copy->levels              = ti->levels;
   ti_copy->first_level         = ti->first_level;
   ti_copy->last_level          = ti->last_level;
@@ -2659,6 +2673,8 @@ static void freeTreeInfo(TreeInfo *ti)
 
     checked_free(ti->level_filename);
     checked_free(ti->level_filetype);
+
+    checked_free(ti->special_flags);
   }
 
   checked_free(ti);
@@ -2681,6 +2697,10 @@ void setSetupInfo(struct TokenInfo *token_info,
       *(boolean *)setup_value = get_boolean_from_string(token_value);
       break;
 
+    case TYPE_SWITCH3:
+      *(int *)setup_value = get_switch3_from_string(token_value);
+      break;
+
     case TYPE_KEY:
       *(Key *)setup_value = getKeyFromKeyName(token_value);
       break;
@@ -3743,10 +3763,20 @@ char *getSetupValue(int type, void *value)
       strcpy(value_string, (*(boolean *)value ? "on" : "off"));
       break;
 
+    case TYPE_SWITCH3:
+      strcpy(value_string, (*(int *)value == AUTO  ? "auto" :
+                           *(int *)value == FALSE ? "off" : "on"));
+      break;
+
     case TYPE_YES_NO:
       strcpy(value_string, (*(boolean *)value ? "yes" : "no"));
       break;
 
+    case TYPE_YES_NO_AUTO:
+      strcpy(value_string, (*(int *)value == AUTO  ? "auto" :
+                           *(int *)value == FALSE ? "no" : "yes"));
+      break;
+
     case TYPE_ECS_AGA:
       strcpy(value_string, (*(boolean *)value ? "AGA" : "ECS"));
       break;