X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=8a99557f557e7cb59bf9eb0f8f174804988b14df;hb=3d0e7db96e3b569b18e0930dbb59716efdbedc8a;hp=7f080d9c6c0f92fbdb4f2c2a860c7975f6a3ba54;hpb=b2fbe97bd09c91e5efb580b35b910a3709015421;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 7f080d9c..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; } @@ -2321,8 +2326,9 @@ SetupFileHash *loadSetupFileHash(char *filename) #define LEVELINFO_TOKEN_SPECIAL_FLAGS 24 #define LEVELINFO_TOKEN_HANDICAP 25 #define LEVELINFO_TOKEN_SKIP_LEVELS 26 +#define LEVELINFO_TOKEN_USE_EMC_TILES 27 -#define NUM_LEVELINFO_TOKENS 27 +#define NUM_LEVELINFO_TOKENS 28 static LevelDirTree ldi; @@ -2355,7 +2361,8 @@ static struct TokenInfo levelinfo_tokens[] = { TYPE_STRING, &ldi.level_filetype, "filetype" }, { TYPE_STRING, &ldi.special_flags, "special_flags" }, { TYPE_BOOLEAN, &ldi.handicap, "handicap" }, - { TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" } + { TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" }, + { TYPE_BOOLEAN, &ldi.use_emc_tiles, "use_emc_tiles" } }; static struct TokenInfo artworkinfo_tokens[] = @@ -2447,6 +2454,8 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) ti->readonly = TRUE; ti->handicap = TRUE; ti->skip_levels = FALSE; + + ti->use_emc_tiles = FALSE; } } @@ -2524,6 +2533,8 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) ti->readonly = parent->readonly; ti->handicap = parent->handicap; ti->skip_levels = parent->skip_levels; + + ti->use_emc_tiles = parent->use_emc_tiles; } } @@ -2589,6 +2600,8 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti) ti_copy->handicap = ti->handicap; ti_copy->skip_levels = ti->skip_levels; + ti_copy->use_emc_tiles = ti->use_emc_tiles; + ti_copy->color = ti->color; ti_copy->class_desc = getStringCopy(ti->class_desc); ti_copy->handicap_level = ti->handicap_level; @@ -3889,6 +3902,11 @@ static boolean AddTreeSetToTreeInfoExt(TreeInfo *tree_node_old, char *tree_dir, { // get level info tree node of personal user level set tree_node_old = getTreeInfoFromIdentifier(leveldir_first, getLoginName()); + + // this may happen if "setup.internal.create_user_levelset" is FALSE + // or if file "levelinfo.conf" is missing in personal user level set + if (tree_node_old == NULL) + tree_node_old = leveldir_first->node_group; } else {