From 1f03a0834b693a361bb98d883cec8f8ef9232681 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 15 Oct 2017 21:06:29 +0200 Subject: [PATCH] replaced duplicate code for updating user level set with function call --- src/editor.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/editor.c b/src/editor.c index cfcf8288..d78703f3 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7508,37 +7508,7 @@ static void ModifyLevelInfoForSavingIntoPersonalLevelSet(char *former_name) } if (level_nr > leveldir_current->last_level) - { - static char *temp_levelinfo = NULL; - FILE *temp_file = NULL; - char line[MAX_LINE_LEN]; - - setString(&temp_levelinfo, - getPath2(getCurrentLevelDir(), - getStringCat2(LEVELINFO_FILENAME, ".new"))); - - if ((file = fopen(filename_levelinfo, MODE_READ)) && - (temp_file = fopen(temp_levelinfo, MODE_WRITE))) - { - while (fgets(line, MAX_LINE_LEN, file)) - { - if (!strPrefix(line, "levels:")) - fputs(line, temp_file); - else - fprintf(temp_file, "%-32s%d\n", "levels:", level_nr + 9); - } - } - - if (temp_file) - fclose(temp_file); - - if (file) - fclose(file); - - // needs error handling; also, ok on dos/win? - unlink(filename_levelinfo); - rename(temp_levelinfo, filename_levelinfo); - } + UpdateUserLevelSet(getLoginName(), NULL, NULL, level_nr + 9, -1); // else: allow the save even if annotation failed -- 2.34.1