From: Holger Schemel Date: Wed, 22 Oct 2014 22:07:32 +0000 (+0200) Subject: added setting default filenames for all cloned static graphics X-Git-Tag: 4.0.0.0-rc1~322 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=983d4e27852f9c81935bf4ae36482f6084264e15 added setting default filenames for all cloned static graphics --- diff --git a/ChangeLog b/ChangeLog index cb8b519f..d98af9f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2014-10-22 * added warnings when using undefined element and graphic names in custom artwork definitions (like ".crumbled_like" or ".clone_from") + * added setting default filenames for all cloned graphics in static + graphics configuration on startup (to be able to fall back later) 2014-10-20 * fixed using buttons on main screen with size other than 32x32 pixels diff --git a/src/init.c b/src/init.c index f431f5b8..aea5c31b 100644 --- a/src/init.c +++ b/src/init.c @@ -4469,6 +4469,33 @@ static void InitGlobal() font_info[i].token_name, int2str(i, 0)); + /* set default filenames for all cloned graphics in static configuration */ + for (i = 0; image_config[i].token != NULL; i++) + { + if (strEqual(image_config[i].value, UNDEFINED_FILENAME)) + { + char *token = image_config[i].token; + char *token_clone_from = getStringCat2(token, ".clone_from"); + char *token_cloned = getHashEntry(image_config_hash, token_clone_from); + + if (token_cloned != NULL) + { + char *value_cloned = getHashEntry(image_config_hash, token_cloned); + + if (value_cloned != NULL) + { + /* set default filename in static configuration */ + image_config[i].value = value_cloned; + + /* set default filename in image config hash */ + setHashEntry(image_config_hash, token, value_cloned); + } + } + + free(token_clone_from); + } + } + /* always start with reliable default values (all elements) */ for (i = 0; i < MAX_NUM_ELEMENTS; i++) ActiveElement[i] = i;