-1
};
+ LevelDirTree *leveldir_current_last = leveldir_current;
boolean init_level_set = FALSE;
int i;
// save score tape to upload to server; may be required for some reasons:
// * level set identifier in solution tapes may differ from level set
+ // * level set identifier is missing (old-style tape without INFO chunk)
// * solution tape may have native format (like Supaplex solution files)
SaveScoreTape(level_nr);
{
autoplay.tape_filename = global.autoplay_leveldir;
+ if (!fileExists(autoplay.tape_filename))
+ Fail("tape file '%s' does not exist", autoplay.tape_filename);
+
LoadTapeFromFilename(autoplay.tape_filename);
if (tape.no_valid_file)
- {
- if (!fileExists(autoplay.tape_filename))
- Fail("tape file '%s' does not exist", autoplay.tape_filename);
- else
- Fail("cannot load tape file '%s'", autoplay.tape_filename);
- }
+ Fail("cannot load tape file '%s'", autoplay.tape_filename);
+
+ if (tape.no_info_chunk && !options.identifier)
+ Fail("cannot get levelset from tape file '%s'", autoplay.tape_filename);
+
+ if (tape.no_info_chunk && !options.level_nr)
+ Fail("cannot get level nr from tape file '%s'", autoplay.tape_filename);
global.autoplay_leveldir = tape.level_identifier;
+ if (options.identifier != NULL)
+ global.autoplay_leveldir = options.identifier;
+
+ if (options.level_nr != NULL)
+ tape.level_nr = atoi(options.level_nr);
+
if (tape.level_nr >= 0 && tape.level_nr < MAX_TAPES_PER_SET)
global.autoplay_level[tape.level_nr] = TRUE;
if (!global.autoplay_all && !global.autoplay_level[level_nr])
continue;
+ if (global.autoplay_mode == AUTOPLAY_MODE_UPLOAD)
+ {
+ // speed things up when uploading all existing private tapes
+ if (autoplay.all_levelsets && !fileExists(getTapeFilename(level_nr)))
+ {
+ autoplay.num_tape_missing++;
+
+ Print("Tape %03d: (no tape found)\n", level_nr);
+
+ continue;
+ }
+ }
+
TapeErase();
TapeRewind(); // needed to reset "tape.auto_play_level_solved"
if (!fileExists(autoplay.tape_filename))
{
- // non-standard solution tape -- save to temporary file
+ // non-standard or incorrect solution tape -- save to temporary file
autoplay.tape_filename = getTemporaryTapeFilename();
SaveTapeToFilename(autoplay.tape_filename);
return num_tapes;
}
+ if (global.autoplay_mode == AUTOPLAY_MODE_UPLOAD)
+ {
+ Print("\n");
+ PrintLine("=", 79);
+ Print("SUMMARY: %d tapes uploaded.\n", num_tapes);
+ PrintLine("=", 79);
+ }
+
// clear timestamp for batch tape upload (required after interactive upload)
global.autoplay_time = 0;
if (program.headless)
CloseAllAndExit(0);
+ // when running interactively, restore last selected level set
+ leveldir_current = leveldir_current_last;
+
return num_tapes;
}