From: Holger Schemel Date: Sun, 13 Mar 2022 10:53:02 +0000 (+0100) Subject: removed reloading artwork set for changed level set if not required (again) X-Git-Tag: 4.3.2.0~76 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fb8b92a605e8a9d509f14b08e35d902984e5dd6b;p=rocksndiamonds.git removed reloading artwork set for changed level set if not required (again) The code that was changed here did the following: Trigger reloading artwork set after a different level set was selected if either the previous or the current level set has custom artwork configured in the file "levelinfo.conf", or if either the previous or the current level set contains a custom artwork sub-directory. But this caused an attempt to reload new artwork even if both the previous and current artwork in file "levelinfo.conf" are identical (but without custom artwork sub-directories contained inside the level sets), which should not happen. Now it is only checked if overriding artwork has changed, or if the identifiers of the previous and current artwork have changed, or if either the previous or current level set contains a custom artwork sub-directory, which then causes the artwork to be reloaded. This was handled incorrectly by (reverted) commit 4ca952cb before. --- diff --git a/src/init.c b/src/init.c index eaee671d..121fab26 100644 --- a/src/init.c +++ b/src/init.c @@ -6029,7 +6029,7 @@ static char *getNewArtworkIdentifier(int type) static char *last_leveldir_identifier[3] = { NULL, NULL, NULL }; static char *last_artwork_identifier[3] = { NULL, NULL, NULL }; static boolean last_override_level_artwork[3] = { FALSE, FALSE, FALSE }; - static boolean last_has_level_artwork_set[3] = { FALSE, FALSE, FALSE }; + static boolean last_has_custom_artwork_set[3] = { FALSE, FALSE, FALSE }; static boolean initialized[3] = { FALSE, FALSE, FALSE }; TreeInfo *artwork_first_node = ARTWORK_FIRST_NODE(artwork, type); boolean setup_override_artwork = GFX_OVERRIDE_ARTWORK(type); @@ -6038,6 +6038,9 @@ static char *getNewArtworkIdentifier(int type) // !!! setLevelArtworkDir() should be moved to an earlier stage !!! char *leveldir_artwork_set = setLevelArtworkDir(artwork_first_node); boolean has_level_artwork_set = (leveldir_artwork_set != NULL); + TreeInfo *custom_artwork_set = + getTreeInfoFromIdentifier(artwork_first_node, leveldir_identifier); + boolean has_custom_artwork_set = (custom_artwork_set != NULL); char *artwork_current_identifier; char *artwork_new_identifier = NULL; // default: nothing has changed @@ -6055,9 +6058,9 @@ static char *getNewArtworkIdentifier(int type) if (setup_override_artwork) artwork_current_identifier = setup_artwork_set; - else if (leveldir_artwork_set != NULL) + else if (has_level_artwork_set) artwork_current_identifier = leveldir_artwork_set; - else if (getTreeInfoFromIdentifier(artwork_first_node, leveldir_identifier)) + else if (has_custom_artwork_set) artwork_current_identifier = leveldir_identifier; else artwork_current_identifier = setup_artwork_set; @@ -6067,11 +6070,11 @@ static char *getNewArtworkIdentifier(int type) // ---------- reload if level set and also artwork set has changed ---------- if (last_leveldir_identifier[type] != leveldir_identifier && - (last_has_level_artwork_set[type] || has_level_artwork_set)) + (last_has_custom_artwork_set[type] || has_custom_artwork_set)) artwork_new_identifier = artwork_current_identifier; last_leveldir_identifier[type] = leveldir_identifier; - last_has_level_artwork_set[type] = has_level_artwork_set; + last_has_custom_artwork_set[type] = has_custom_artwork_set; // ---------- reload if "override artwork" setting has changed -------------- if (last_override_level_artwork[type] != setup_override_artwork)