fixed bug which could cause saving tapes with a wrong level number filename
[rocksndiamonds.git] / src / tape.c
index f0a8f02dce18ea2ae838c46840d7c67a80e7a106..831659b62cb881ac47353c1e37992d3917c8d57b 100644 (file)
@@ -376,15 +376,18 @@ void DrawVideoDisplayCurrentState()
   {
     state |= VIDEO_STATE_PLAY_ON;
 
-    if (tape.deactivate_display)
-      state |= VIDEO_STATE_WARP2_ON;
-    else if (tape.warp_forward)
-      state |= VIDEO_STATE_WARP_ON;
-    else if (tape.fast_forward)
-      state |= VIDEO_STATE_FFWD_ON;
-
-    if (tape.pause_before_end)
-      state |= VIDEO_STATE_PBEND_ON;
+    if (!tape.pausing)
+    {
+      if (tape.deactivate_display)
+       state |= VIDEO_STATE_WARP2_ON;
+      else if (tape.warp_forward)
+       state |= VIDEO_STATE_WARP_ON;
+      else if (tape.fast_forward)
+       state |= VIDEO_STATE_FFWD_ON;
+
+      if (tape.pause_before_end)
+       state |= VIDEO_STATE_PBEND_ON;
+    }
   }
 
   // draw labels and symbols separately to prevent labels overlapping symbols
@@ -1063,13 +1066,23 @@ void TapeQuickLoad()
 
 void InsertSolutionTape()
 {
-  if (!TAPE_IS_EMPTY(tape))
+  boolean level_has_tape = (level.game_engine_type == GAME_ENGINE_TYPE_SP &&
+                           level.native_sp_level->demo.is_available);
+
+  if (!fileExists(getSolutionTapeFilename(level_nr)) && !level_has_tape)
+  {
+    Request("No solution tape for this level!", REQ_CONFIRM);
+
     return;
+  }
+
+  // if tape recorder already contains a tape, remove it without asking
+  TapeErase();
 
   LoadSolutionTape(level_nr);
 
   if (TAPE_IS_EMPTY(tape))
-    Request("No solution tape for this level!", REQ_CONFIRM);
+    Request("Loading solution tape for this level failed!", REQ_CONFIRM);
 
   DrawCompleteVideoDisplay();
 }
@@ -1381,7 +1394,7 @@ static void HandleTapeButtonsExt(int id)
       else
       {
        if (tape.changed)
-         SaveTapeChecked(tape.level_nr);
+         SaveTapeChecked(level_nr);
 
        TapeErase();
       }