X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;fp=src%2Flibgame%2Fsetup.c;h=7e34711afcbb0719f258cf1e2e0384a2b71e8e04;hp=3557e949273a30f1c3ffc5f3ddd7b456af62ac2b;hb=fb402760dddcc06205acbcc8123ee99a11536b84;hpb=8ff72a216ac9dfefcb4cf85b47063600867ceec2 diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 3557e949..7e34711a 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -70,6 +70,7 @@ static int token_comment_position = TOKEN_COMMENT_POSITION_DEFAULT; static SetupFileHash *artworkinfo_cache_old = NULL; static SetupFileHash *artworkinfo_cache_new = NULL; static SetupFileHash *optional_tokens_hash = NULL; +static SetupFileHash *missing_file_hash = NULL; static boolean use_artworkinfo_cache = TRUE; static boolean update_artworkinfo_cache = FALSE; @@ -78,6 +79,16 @@ static boolean update_artworkinfo_cache = FALSE; // file functions // ---------------------------------------------------------------------------- +static void WarnUsingFallback(char *filename) +{ + if (getHashEntry(missing_file_hash, filename) == NULL) + { + setHashEntry(missing_file_hash, filename, ""); + + Warn("cannot find artwork file '%s' (using fallback)", filename); + } +} + static char *getLevelClassDescription(TreeInfo *ti) { int position = ti->sort_priority / 100; @@ -976,7 +987,7 @@ char *getCustomImageFilename(char *basename) { free(filename); - Warn("cannot find artwork file '%s' (using fallback)", basename); + WarnUsingFallback(basename); // 6th try: look for fallback artwork in old default artwork directory // (needed to prevent errors when trying to access unused artwork files) @@ -1047,7 +1058,7 @@ char *getCustomSoundFilename(char *basename) { free(filename); - Warn("cannot find artwork file '%s' (using fallback)", basename); + WarnUsingFallback(basename); // 6th try: look for fallback artwork in old default artwork directory // (needed to prevent errors when trying to access unused artwork files) @@ -1118,7 +1129,7 @@ char *getCustomMusicFilename(char *basename) { free(filename); - Warn("cannot find artwork file '%s' (using fallback)", basename); + WarnUsingFallback(basename); // 6th try: look for fallback artwork in old default artwork directory // (needed to prevent errors when trying to access unused artwork files) @@ -1242,6 +1253,14 @@ boolean CheckTapeDirectoryUploadsComplete(char *level_subdir) return success; } +void InitMissingFileHash(void) +{ + if (missing_file_hash == NULL) + freeSetupFileHash(missing_file_hash); + + missing_file_hash = newSetupFileHash(); +} + void InitTapeDirectory(char *level_subdir) { boolean new_tape_dir = !directoryExists(getTapeDir(level_subdir));