From: Holger Schemel Date: Tue, 17 Oct 2017 16:57:55 +0000 (+0200) Subject: added updating internal level directory tree when changing user level set X-Git-Tag: 4.1.0.0~93 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4092afb639cd525d6d3edd4a287c1b506ba9c1d2;p=rocksndiamonds.git added updating internal level directory tree when changing user level set --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index d8578837..d683b67c 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -3526,6 +3526,30 @@ boolean UpdateUserLevelSet(char *level_subdir, FILE *file_tmp = NULL; char line[MAX_LINE_LEN]; boolean success = FALSE; + LevelDirTree *leveldir = getTreeInfoFromIdentifier(leveldir_first, + level_subdir); + // update values in level directory tree + + if (level_name != NULL) + setString(&leveldir->name, level_name); + + if (level_author != NULL) + setString(&leveldir->author, level_author); + + if (num_levels != -1) + leveldir->levels = num_levels; + + if (first_level_nr != -1) + leveldir->first_level = first_level_nr; + + // update values that depend on other values + + setString(&leveldir->name_sorting, leveldir->name); + + leveldir->last_level = leveldir->first_level + leveldir->levels - 1; + + // sort order of level sets may have changed + sortTreeInfo(&leveldir_first); if ((file = fopen(filename, MODE_READ)) && (file_tmp = fopen(filename_tmp, MODE_WRITE)))