From 436a9fbb93a26d17c80eae4b8bbe79dabfc44099 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 1 Sep 2007 15:41:01 +0200 Subject: [PATCH] rnd-20070901-2-src * fixed bug when defined artwork cannot be found for artwork that has default artwork cloned from other artwork (without default filename) --- ChangeLog | 2 ++ src/conftime.h | 2 +- src/libgame/misc.c | 22 ++++++++++++++++++++++ src/libgame/system.h | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b01037e4..74879852 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ element was calculated by using log_2() from trigger player bits with the value PLAYER_BITS_ANY) -- this is now fixed by also storing the triggering player bit mask and handling all players in "move player" + * fixed bug when defined artwork cannot be found for artwork that has + default artwork cloned from other artwork (without default filename) 2007-08-26 * fixed broken editor copy and paste for custom elements between levels diff --git a/src/conftime.h b/src/conftime.h index bffffdba..b4b712b4 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-01 10:49" +#define COMPILE_DATE_STRING "2007-09-01 15:35" diff --git a/src/libgame/misc.c b/src/libgame/misc.c index a20948d5..3d63cc5c 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1992,6 +1992,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, file_list[i].redefined = FALSE; file_list[i].fallback_to_default = FALSE; + file_list[i].default_is_cloned = FALSE; } } @@ -2048,6 +2049,9 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, printf("::: '%s' => '%s'\n", config_list[i].token, config_list[i].value); #endif } + + if (strSuffix(config_list[i].token, ".clone_from")) + file_list[list_pos].default_is_cloned = TRUE; } num_file_list_entries_found = list_pos + 1; @@ -2156,6 +2160,7 @@ static void add_dynamic_file_list_entry(struct FileInfo **list, new_list_entry->redefined = FALSE; new_list_entry->fallback_to_default = FALSE; + new_list_entry->default_is_cloned = FALSE; read_token_parameters(extra_file_hash, suffix_list, new_list_entry); } @@ -2708,6 +2713,22 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, basename = file_list_entry->default_filename; + /* fail for cloned default artwork that has no default filename defined */ + if (file_list_entry->default_is_cloned && + strEqual(basename, UNDEFINED_FILENAME)) + { + int error_mode = ERR_WARN; + + /* we can get away without sounds and music, but not without graphics */ + if (*listnode == NULL && artwork_info->type == ARTWORK_TYPE_GRAPHICS) + error_mode = ERR_EXIT; + + Error(error_mode, "token '%s' was cloned and has no default filename", + file_list_entry->token); + + return; + } + /* dynamic artwork has no default filename / skip empty default artwork */ if (basename == NULL || strEqual(basename, UNDEFINED_FILENAME)) return; @@ -2784,6 +2805,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, error_mode = ERR_EXIT; Error(error_mode, "cannot load artwork file '%s'", basename); + return; } } diff --git a/src/libgame/system.h b/src/libgame/system.h index 5d26341f..7288845f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -987,6 +987,7 @@ struct FileInfo boolean redefined; boolean fallback_to_default; + boolean default_is_cloned; }; struct SetupFileList -- 2.34.1