X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=8a99557f557e7cb59bf9eb0f8f174804988b14df;hb=b844b9ff4b1c79c5789cdae0a90deacb88d0887a;hp=7e87a76e1153dbf6551d0a44da71cf69d4d4be1a;hpb=2c459683357975006225050ef9498af29b7fc01a;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 7e87a76e..8a99557f 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -457,7 +457,7 @@ char *getProgramMainDataPath(char *command_filename, char *base_path) { // check if the program's main data base directory is configured if (!strEqual(base_path, ".")) - return base_path; + return getStringCopy(base_path); /* if the program is configured to start from current directory (default), determine program package directory from program binary (some versions @@ -1093,7 +1093,8 @@ void InitUserLevelDirectory(char *level_subdir) createDirectory(getUserLevelDir(NULL), "main user level", PERMS_PRIVATE); createDirectory(getUserLevelDir(level_subdir), "user level", PERMS_PRIVATE); - SaveUserLevelInfo(); + if (setup.internal.create_user_levelset) + SaveUserLevelInfo(); } } @@ -1301,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; } @@ -2320,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; @@ -2354,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[] = @@ -2446,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; } } @@ -2523,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; } } @@ -2588,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; @@ -3888,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 {