From: Holger Schemel Date: Sat, 28 Mar 2020 10:57:35 +0000 (+0100) Subject: fixed selecting ECS/AGA graphics if only ECS or AGA graphics exists X-Git-Tag: 4.2.0.0~58 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=3d0e7db96e3b569b18e0930dbb59716efdbedc8a;hp=d4c19f2f629758803f62f52809c889052ddf3ccf fixed selecting ECS/AGA graphics if only ECS or AGA graphics exists In rare cases (like in EMC level set "emc_no_one_mine_19"), there are only ECS or AGA graphics available, but not both (as it is usually the case). If this happened, the available graphics set was not selected if the ECS/AGA preference settings did not match (for example, if ECS graphics are preferred, but only AGA graphics are available). As no level set specific graphics were selected at all in such a case, this resulted in falling back to the R'n'D default graphics. This bug was fixed by ignoring the ECS/AGA graphics preference in such cases, but always using the only available graphics set instead. --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 300e815d..8a99557f 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1302,16 +1302,21 @@ static boolean adjustTreeGraphicsForEMC(TreeInfo *node) while (node) { - if (node->graphics_set_ecs && !setup.prefer_aga_graphics && - !strEqual(node->graphics_set, node->graphics_set_ecs)) - { - setString(&node->graphics_set, node->graphics_set_ecs); - settings_changed = TRUE; - } - else if (node->graphics_set_aga && setup.prefer_aga_graphics && - !strEqual(node->graphics_set, node->graphics_set_aga)) + boolean want_ecs = (setup.prefer_aga_graphics == FALSE); + boolean want_aga = (setup.prefer_aga_graphics == TRUE); + boolean has_only_ecs = (!node->graphics_set && !node->graphics_set_aga); + boolean has_only_aga = (!node->graphics_set && !node->graphics_set_ecs); + char *graphics_set = NULL; + + if (node->graphics_set_ecs && (want_ecs || has_only_ecs)) + graphics_set = node->graphics_set_ecs; + + if (node->graphics_set_aga && (want_aga || has_only_aga)) + graphics_set = node->graphics_set_aga; + + if (graphics_set && !strEqual(node->graphics_set, graphics_set)) { - setString(&node->graphics_set, node->graphics_set_aga); + setString(&node->graphics_set, graphics_set); settings_changed = TRUE; }