+ printf("['%s' (%d)]\n", node->key,
+ ((struct ListNodeInfo *)node->content)->num_references);
+ node = node->next;
+ }
+
+ printf("[%d nodes]\n", getNumNodes(node_first));
+}
+
+
+/* ------------------------------------------------------------------------- */
+/* functions for checking filenames */
+/* ------------------------------------------------------------------------- */
+
+boolean FileIsGraphic(char *filename)
+{
+ if (strlen(filename) > 4 &&
+ strcmp(&filename[strlen(filename) - 4], ".pcx") == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+boolean FileIsSound(char *basename)
+{
+ if (strlen(basename) > 4 &&
+ strcmp(&basename[strlen(basename) - 4], ".wav") == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+boolean FileIsMusic(char *basename)
+{
+ /* "music" can be a WAV (loop) file or (if compiled with SDL) a MOD file */
+
+ if (FileIsSound(basename))
+ return TRUE;
+
+#if defined(TARGET_SDL)
+ if (strlen(basename) > 4 &&
+ (strcmp(&basename[strlen(basename) - 4], ".mod") == 0 ||
+ strcmp(&basename[strlen(basename) - 4], ".MOD") == 0 ||
+ strncmp(basename, "mod.", 4) == 0 ||
+ strncmp(basename, "MOD.", 4) == 0))
+ return TRUE;
+#endif
+
+ return FALSE;
+}
+
+boolean FileIsArtworkType(char *basename, int type)
+{
+ if ((type == TREE_TYPE_GRAPHICS_DIR && FileIsGraphic(basename)) ||
+ (type == TREE_TYPE_SOUNDS_DIR && FileIsSound(basename)) ||
+ (type == TREE_TYPE_MUSIC_DIR && FileIsMusic(basename)))
+ return TRUE;
+
+ return FALSE;
+}
+
+/* ------------------------------------------------------------------------- */
+/* functions for loading artwork configuration information */
+/* ------------------------------------------------------------------------- */
+
+static void FreeCustomArtworkList(struct ArtworkListInfo *,
+ struct ListNodeInfo ***, int *);
+
+static int get_parameter_value(int type, char *value)
+{
+ return (strcmp(value, ARG_UNDEFINED) == 0 ? ARG_UNDEFINED_VALUE :
+ type == TYPE_INTEGER ? get_integer_from_string(value) :
+ type == TYPE_BOOLEAN ? get_boolean_from_string(value) :
+ -1);
+}
+
+struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
+ struct ConfigInfo *suffix_list,
+ int num_file_list_entries)
+{
+ struct FileInfo *file_list;
+ int num_file_list_entries_found = 0;
+ int num_suffix_list_entries = 0;
+ int list_pos = 0;
+ int i, j;
+
+ file_list = checked_calloc(num_file_list_entries * sizeof(struct FileInfo));
+
+ for (i=0; suffix_list[i].token != NULL; i++)
+ num_suffix_list_entries++;
+
+ /* always start with reliable default values */
+ for (i=0; i<num_file_list_entries; i++)
+ {
+ file_list[i].token = NULL;
+ file_list[i].default_filename = NULL;
+ file_list[i].filename = NULL;
+
+ if (num_suffix_list_entries > 0)