From: Holger Schemel Date: Sun, 5 Sep 2021 22:20:48 +0000 (+0200) Subject: changed interface for functions to auto-play tapes to return played tapes X-Git-Tag: 4.3.0.0~68 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fa64f97687b19543379b872003cd66a2a351e326;p=rocksndiamonds.git changed interface for functions to auto-play tapes to return played tapes --- diff --git a/src/screens.c b/src/screens.c index e3294c1b..30bb2b20 100644 --- a/src/screens.c +++ b/src/screens.c @@ -9829,7 +9829,7 @@ void DrawScreenAfterAddingSet(char *tree_subdir_new, int tree_type) } } -static void UploadTapes(void) +static int UploadTapes(void) { SetGameStatus(GAME_MODE_LOADING); @@ -9846,7 +9846,7 @@ static void UploadTapes(void) global.autoplay_leveldir = "ALL"; global.autoplay_all = TRUE; - AutoPlayTapes(); + int num_tapes_uploaded = AutoPlayTapes(); global.autoplay_mode = AUTOPLAY_MODE_NONE; global.autoplay_leveldir = NULL; @@ -9855,6 +9855,8 @@ static void UploadTapes(void) SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); + + return num_tapes_uploaded; } void CheckUploadTapes(void) @@ -9866,9 +9868,12 @@ void CheckUploadTapes(void) { if (Request("Upload all your tapes to the high score server now?", REQ_ASK)) { - UploadTapes(); + int num_tapes_uploaded = UploadTapes(); + char message[100]; + + sprintf(message, "%d tapes uploaded!", num_tapes_uploaded); - Request("All tapes uploaded!", REQ_CONFIRM); + Request(message, REQ_CONFIRM); } else { diff --git a/src/tape.c b/src/tape.c index 62cb3e0d..cb6a9f92 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1427,9 +1427,10 @@ static void AutoPlayTapes_WaitForUpload(void) Print("- uploading score tape to score server - uploaded.\n"); } -static void AutoPlayTapesExt(boolean initialize) +static int AutoPlayTapesExt(boolean initialize) { static struct AutoPlayInfo autoplay; + static int num_tapes = 0; static int patch_nr = 0; static char *patch_name[] = { @@ -1614,6 +1615,8 @@ static void AutoPlayTapesExt(boolean initialize) if (global.autoplay_mode == AUTOPLAY_MODE_FIX) options.mytapes = TRUE; + num_tapes = 0; + init_level_set = TRUE; } @@ -1768,6 +1771,8 @@ static void AutoPlayTapesExt(boolean initialize) } } + num_tapes++; + if (global.autoplay_mode == AUTOPLAY_MODE_UPLOAD) { boolean use_temporary_tape_file = FALSE; @@ -1815,21 +1820,23 @@ static void AutoPlayTapesExt(boolean initialize) autoplay.last_level_nr = level_nr; - return; + return num_tapes; } if (program.headless) CloseAllAndExit(0); + + return num_tapes; } -void AutoPlayTapes(void) +int AutoPlayTapes(void) { - AutoPlayTapesExt(TRUE); + return AutoPlayTapesExt(TRUE); } -void AutoPlayTapesContinue(void) +int AutoPlayTapesContinue(void) { - AutoPlayTapesExt(FALSE); + return AutoPlayTapesExt(FALSE); } diff --git a/src/tape.h b/src/tape.h index b0d1d672..09027d51 100644 --- a/src/tape.h +++ b/src/tape.h @@ -275,8 +275,8 @@ boolean PlaySolutionTape(void); void UndoTape(void); void FixTape_ForceSinglePlayer(void); -void AutoPlayTapes(void); -void AutoPlayTapesContinue(void); +int AutoPlayTapes(void); +int AutoPlayTapesContinue(void); void PatchTapes(void); void CreateTapeButtons(void);