}
}
-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)))
{
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;
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;
}
void LoadTapeFromFilename(char *);
void LoadTape(int);
void LoadSolutionTape(int);
+void SaveTapeToFilename(char *);
void SaveTape(int);
void DumpTape(struct TapeInfo *);
boolean SaveTapeChecked(int);