added setup option to save tape without asking
authorHolger Schemel <holger.schemel@virtion.de>
Wed, 8 Jan 2025 22:47:08 +0000 (23:47 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Wed, 8 Jan 2025 22:47:08 +0000 (23:47 +0100)
src/files.c
src/libgame/system.h
src/screens.c

index c6faf9e589784302c5f82b0a5a1171b5d50342a3..92757dd5fc1e22384bc9adf0803e494f528dbc5e 100644 (file)
@@ -9972,6 +9972,11 @@ void SaveScoreTape(int nr)
   SaveTapeExt(filename);
 }
 
+static boolean SaveTapeRequest(char *msg, unsigned int req_state)
+{
+  return (!setup.ask_on_save_tape || Request(msg, req_state));
+}
+
 static boolean SaveTapeCheckedExt(int nr, char *msg_replace, char *msg_saved,
                                  unsigned int req_state_added)
 {
@@ -9979,12 +9984,12 @@ static boolean SaveTapeCheckedExt(int nr, char *msg_replace, char *msg_saved,
   boolean new_tape = !fileExists(filename);
   boolean tape_saved = FALSE;
 
-  if (new_tape || Request(msg_replace, REQ_ASK | req_state_added))
+  if (new_tape || SaveTapeRequest(msg_replace, REQ_ASK | req_state_added))
   {
     SaveTape(nr);
 
     if (new_tape)
-      Request(msg_saved, REQ_CONFIRM | req_state_added);
+      SaveTapeRequest(msg_saved, REQ_CONFIRM | req_state_added);
 
     tape_saved = TRUE;
   }
@@ -10969,6 +10974,10 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH,
     &setup.ask_on_escape_editor,               "ask_on_escape_editor"
   },
+  {
+    TYPE_SWITCH,
+    &setup.ask_on_save_tape,                   "ask_on_save_tape"
+  },
   {
     TYPE_SWITCH,
     &setup.ask_on_game_over,                   "ask_on_game_over"
@@ -11925,6 +11934,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->vsync_mode = getStringCopy(STR_VSYNC_MODE_DEFAULT);
   si->ask_on_escape = TRUE;
   si->ask_on_escape_editor = TRUE;
+  si->ask_on_save_tape = TRUE;
   si->ask_on_game_over = TRUE;
   si->ask_on_quit_game = TRUE;
   si->ask_on_quit_program = TRUE;
index 5bae5afbdaac76c1a52600d603d67703933ac755..e07c553b0336247981afaaf21c6ae3a8400fa7af 100644 (file)
@@ -1568,6 +1568,7 @@ struct SetupInfo
   char *vsync_mode;
   boolean ask_on_escape;
   boolean ask_on_escape_editor;
+  boolean ask_on_save_tape;
   boolean ask_on_game_over;
   boolean ask_on_quit_game;
   boolean ask_on_quit_program;
index e7c233a1bcbbb2d42bb88bdfbabfa1e5c5af51b2..2de3946c0bddd929a64b312a79370d274f596bf6 100644 (file)
@@ -8547,6 +8547,7 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.auto_play_next_level,    "Auto-play Next Level:"         },
   { TYPE_SWITCH,       &setup.count_score_after_game,  "Count Score After Game:"       },
   { TYPE_SWITCH,       &setup.show_scores_after_game,  "Show Scores After Game:"       },
+  { TYPE_YES_NO,       &setup.ask_on_save_tape,        "Ask on Save Tape:"             },
   { TYPE_YES_NO,       &setup.ask_on_game_over,        "Ask on Game Over:"             },
   { TYPE_YES_NO,       &setup.ask_on_quit_game,        "Ask on Quit Game:"             },
   { TYPE_YES_NO,       &setup.ask_on_quit_program,     "Ask on Quit Program:"          },