levelset_save_mode = LEVELSET_SAVE_MODE_UPDATE;
}
+static void ChangeEditorToLevelSet(char *levelset_subdir)
+{
+ leveldir_current = getTreeInfoFromIdentifier(leveldir_first, levelset_subdir);
+
+ // the previous level set might have used custom artwork
+ ReloadCustomArtwork(0);
+
+ LoadLevelSetup_SeriesInfo();
+
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+
+ TapeErase();
+
+ LoadLevel(level_nr);
+ LoadScore(level_nr);
+
+ DrawLevelEd();
+}
+
void DrawLevelEd()
{
int fade_mask = REDRAW_FIELD;
levelset_first_level_nr))
{
Request("New level set created!", REQ_CONFIRM);
+
+ AddUserLevelSetToLevelInfo(levelset_subdir);
+ ChangeEditorToLevelSet(levelset_subdir);
}
else
{
Request("Creating new level set failed!", REQ_CONFIRM);
}
-
- DrawLevelInfoWindow(); // update (increment) level set directory name
}
}
else if (type_id == ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE &&
print_timestamp_done("LoadLevelArtworkInfo");
}
+static boolean AddUserLevelSetToLevelInfoExt(char *level_subdir_new)
+{
+ // get level info tree node of first (original) user level set
+ char *level_subdir_old = getLoginName();
+ LevelDirTree *leveldir_old = getTreeInfoFromIdentifier(leveldir_first,
+ level_subdir_old);
+ if (leveldir_old == NULL) // should not happen
+ return FALSE;
+
+ int draw_deactivation_mask = GetDrawDeactivationMask();
+
+ // override draw deactivation mask (temporarily disable drawing)
+ SetDrawDeactivationMask(REDRAW_ALL);
+
+ // load new level set config and add it next to first user level set
+ LoadLevelInfoFromLevelConf(&leveldir_old->next, NULL,
+ leveldir_old->basepath, level_subdir_new);
+
+ // set draw deactivation mask to previous value
+ SetDrawDeactivationMask(draw_deactivation_mask);
+
+ // get level info tree node of newly added user level set
+ LevelDirTree *leveldir_new = getTreeInfoFromIdentifier(leveldir_first,
+ level_subdir_new);
+ if (leveldir_new == NULL) // should not happen
+ return FALSE;
+
+ // correct top link and parent node link of newly created tree node
+ leveldir_new->node_top = leveldir_old->node_top;
+ leveldir_new->node_parent = leveldir_old->node_parent;
+
+ // sort level info tree to adjust position of newly added level set
+ sortTreeInfo(&leveldir_first);
+
+ return TRUE;
+}
+
+void AddUserLevelSetToLevelInfo(char *level_subdir_new)
+{
+ if (!AddUserLevelSetToLevelInfoExt(level_subdir_new))
+ Error(ERR_EXIT, "internal level set structure corrupted -- aborting");
+}
+
boolean UpdateUserLevelSet(char *level_subdir,
char *level_name, char *level_author,
int num_levels, int first_level_nr)
void LoadArtworkInfo(void);
void LoadLevelArtworkInfo(void);
+void AddUserLevelSetToLevelInfo(char *);
boolean UpdateUserLevelSet(char *, char *, char *, int, int);
boolean CreateUserLevelSet(char *, char *, char *, int, int);