changed interface for functions to auto-play tapes to return played tapes
authorHolger Schemel <info@artsoft.org>
Sun, 5 Sep 2021 22:20:48 +0000 (00:20 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 5 Sep 2021 22:20:48 +0000 (00:20 +0200)
src/screens.c
src/tape.c
src/tape.h

index e3294c1bd8691edd0fb4c6df8992e030b485c860..30bb2b20ee43b65fea9d8ed112b4aea9a694df89 100644 (file)
@@ -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
     {
index 62cb3e0d102785f5d5dec5c879c9ce55bddecd65..cb6a9f9271b6b3f08d614f3c7a6b8ea7b72c581c 100644 (file)
@@ -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);
 }
 
 
index b0d1d6725bd7401fde08a04cd43e7139a0c7acda..09027d51b035e5ba61bf79868366243132d753fd 100644 (file)
@@ -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);