X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=32fbf32b9ee3618c0a154dfc80ab781dd1a48c6a;hb=76d9e113943e9f28f30dbb21ca2e8175ac5af560;hp=283ebf0f795a7ef15aff44521301d28d88036005;hpb=1006b2dbfc57cf28d482faa99be6de5a75adeeb3;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 283ebf0f..32fbf32b 100644 --- a/src/files.c +++ b/src/files.c @@ -8144,16 +8144,12 @@ static void SaveTape_BODY(FILE *file, struct TapeInfo *tape) } } -void SaveTape(int nr) +void SaveTapeToFilename(char *filename) { - char *filename = getTapeFilename(nr); FILE *file; int tape_pos_size; int info_chunk_size; int body_chunk_size; - int i; - - InitTapeDirectory(leveldir_current->subdir); if (!(file = fopen(filename, MODE_WRITE))) { @@ -8161,16 +8157,6 @@ void SaveTape(int nr) return; } - tape.file_version = FILE_VERSION_ACTUAL; - tape.game_version = GAME_VERSION_ACTUAL; - - tape.num_participating_players = 0; - - // count number of participating players - for (i = 0; i < MAX_PLAYERS; i++) - if (tape.player_participates[i]) - tape.num_participating_players++; - tape_pos_size = getTapePosSize(&tape); info_chunk_size = 2 + (strlen(tape.level_identifier) + 1) + 2; @@ -8194,6 +8180,26 @@ void SaveTape(int nr) fclose(file); SetFilePermissions(filename, PERMS_PRIVATE); +} + +void SaveTape(int nr) +{ + char *filename = getTapeFilename(nr); + int i; + + InitTapeDirectory(leveldir_current->subdir); + + tape.file_version = FILE_VERSION_ACTUAL; + tape.game_version = GAME_VERSION_ACTUAL; + + tape.num_participating_players = 0; + + // count number of participating players + for (i = 0; i < MAX_PLAYERS; i++) + if (tape.player_participates[i]) + tape.num_participating_players++; + + SaveTapeToFilename(filename); tape.changed = FALSE; }