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

index 23e0b113c01b0bc4f52424330a6dad50889ba5f5..cfab48e7250f1c5888648fbe8d267c65fa748269 100644 (file)
@@ -9034,10 +9034,10 @@ void HandleGameActions(void)
   if (game_status != GAME_MODE_PLAYING)
     return;
 
-  GameActions();       // main game loop
+  GameActions();               // main game loop
 
   if (tape.auto_play && !tape.playing)
-    AutoPlayTapes();   // continue automatically playing next tape
+    AutoPlayTapesContinue();   // continue automatically playing next tape
 }
 
 
index f957ba97d6ccb404a13c792fad3c8b4e6f7a67bd..c14b21694940eea6c63844c1bd0e2f25285d4623 100644 (file)
@@ -474,7 +474,6 @@ void TapeDeactivateDisplayOff(boolean redraw_display)
 struct AutoPlayInfo
 {
   LevelDirTree *leveldir;
-  boolean initialized;
   boolean all_levelsets;
   int last_level_nr;
   int level_nr;
@@ -1404,7 +1403,7 @@ static void AutoPlayTapes_WaitForUpload(void)
   Print("- uploading score tape to score server - uploaded.\n");
 }
 
-void AutoPlayTapes(void)
+static void AutoPlayTapesExt(boolean initialize)
 {
   static struct AutoPlayInfo autoplay;
   static int patch_nr = 0;
@@ -1443,7 +1442,7 @@ void AutoPlayTapes(void)
   boolean init_level_set = FALSE;
   int i;
 
-  if (autoplay.initialized)
+  if (!initialize)
   {
     if (global.autoplay_mode == AUTOPLAY_MODE_FIX)
     {
@@ -1578,7 +1577,6 @@ void AutoPlayTapes(void)
       // auto-play selected level set
       autoplay.leveldir = getTreeInfoFromIdentifier(leveldir_first,
                                                    global.autoplay_leveldir);
-
     }
 
     if (autoplay.leveldir == NULL)
@@ -1589,8 +1587,6 @@ void AutoPlayTapes(void)
       options.mytapes = TRUE;
 
     init_level_set = TRUE;
-
-    autoplay.initialized = TRUE;
   }
 
   while (1)
@@ -1795,6 +1791,16 @@ void AutoPlayTapes(void)
   CloseAllAndExit(0);
 }
 
+void AutoPlayTapes(void)
+{
+  AutoPlayTapesExt(TRUE);
+}
+
+void AutoPlayTapesContinue(void)
+{
+  AutoPlayTapesExt(FALSE);
+}
+
 
 // ----------------------------------------------------------------------------
 // tape patch functions
index e710fa33fb2110737019b11a82fee5dd9345568d..b0d1d6725bd7401fde08a04cd43e7139a0c7acda 100644 (file)
@@ -276,6 +276,7 @@ void UndoTape(void);
 void FixTape_ForceSinglePlayer(void);
 
 void AutoPlayTapes(void);
+void AutoPlayTapesContinue(void);
 void PatchTapes(void);
 
 void CreateTapeButtons(void);