X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=d78703f3fdb6778df28484b1cd23ea635d65f198;hb=1f03a0834b693a361bb98d883cec8f8ef9232681;hp=71304ba01f4fcfaa046a507e89eaa73201851d9c;hpb=fd86711daeb69b7ad341cccbbed0ee63561dba9a;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 71304ba0..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 @@ -8660,6 +8630,24 @@ static void DrawPropertiesTabulatorGadgets() getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color); } +static void PrintInfoText(char *text, int font_nr, int xpos, int ypos) +{ + DrawText(SX + xpos, SY + ypos, text, font_nr); +} + +static int PrintElementDescriptionFromFile(char *filename, int font_nr, + int xpos, int ypos) +{ + int font_width = getFontWidth(font_nr); + int font_height = getFontHeight(font_nr); + int max_chars_per_line = (SXSIZE - 2 * xpos) / font_width; + int max_lines_drawable = (SYSIZE - ypos) / font_height - 1; + + return DrawTextFile(SX + xpos, SY + ypos, filename, font_nr, + max_chars_per_line, -1, max_lines_drawable, 0, -1, + TRUE, FALSE, FALSE); +} + static void DrawLevelInfoLevel() { int i; @@ -8947,24 +8935,6 @@ static void DrawEnvelopeTextArea(int envelope_nr) MapTextAreaGadget(ED_TEXTAREA_ID_ENVELOPE_INFO); } -static void PrintInfoText(char *text, int font_nr, int xpos, int ypos) -{ - DrawText(SX + xpos, SY + ypos, text, font_nr); -} - -static int PrintElementDescriptionFromFile(char *filename, int font_nr, - int xpos, int ypos) -{ - int font_width = getFontWidth(font_nr); - int font_height = getFontHeight(font_nr); - int max_chars_per_line = (SXSIZE - 2 * xpos) / font_width; - int max_lines_drawable = (SYSIZE - ypos) / font_height - 1; - - return DrawTextFile(SX + xpos, SY + ypos, filename, font_nr, - max_chars_per_line, -1, max_lines_drawable, 0, -1, - TRUE, FALSE, FALSE); -} - static void DrawPropertiesInfo() { static struct