int num_tapes_uploaded = UploadTapes();
char message[100];
- sprintf(message, "%d tapes uploaded!", num_tapes_uploaded);
+ if (num_tapes_uploaded < 0)
+ {
+ Request("Cannot upload tapes to score server!", REQ_CONFIRM);
+
+ return FALSE;
+ }
+
+ if (num_tapes_uploaded == 0)
+ sprintf(message, "No tapes uploaded!");
+ else if (num_tapes_uploaded == 1)
+ sprintf(message, "1 tape uploaded!");
+ else
+ sprintf(message, "%d tapes uploaded!", num_tapes_uploaded);
Request(message, REQ_CONFIRM);
SaveSetup();
- return (num_tapes_uploaded > 0);
+ return TRUE;
}
void CheckUploadTapes(void)
server_scores.uploaded = FALSE;
}
-static void AutoPlayTapes_WaitForUpload(void)
+static boolean AutoPlayTapes_WaitForUpload(void)
{
unsigned int upload_delay = 0;
unsigned int upload_delay_value = 10000;
PrintNoLog("\r");
Print("- uploading score tape to score server - TIMEOUT.\n");
- Fail("cannot upload score tape to score server");
+ if (program.headless)
+ Fail("cannot upload score tape to score server");
+
+ return FALSE;
}
UPDATE_BUSY_STATE();
PrintNoLog("\r");
Print("- uploading score tape to score server - uploaded.\n");
+
+ return TRUE;
}
static int AutoPlayTapesExt(boolean initialize)
SaveServerScoreFromFile(level_nr, autoplay.tape_filename);
- AutoPlayTapes_WaitForUpload();
+ boolean success = AutoPlayTapes_WaitForUpload();
if (use_temporary_tape_file)
unlink(autoplay.tape_filename);
// required for uploading multiple tapes
autoplay.tape_filename = NULL;
+ if (!success)
+ {
+ num_tapes = -1;
+
+ break;
+ }
+
continue;
}
{
Print("\n");
PrintLine("=", 79);
- Print("SUMMARY: %d tapes uploaded.\n", num_tapes);
+
+ if (num_tapes >= 0)
+ Print("SUMMARY: %d tapes uploaded.\n", num_tapes);
+ else
+ Print("SUMMARY: Uploading tapes failed.\n");
+
PrintLine("=", 79);
}