added asking before uploading scores and tapes for the first time
authorHolger Schemel <info@artsoft.org>
Sun, 31 Oct 2021 00:17:08 +0000 (02:17 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 31 Oct 2021 00:27:48 +0000 (02:27 +0200)
src/files.c
src/game.c
src/libgame/system.h

index 4c5a366138a27fb6df88a3ce6a2688ce4e82c93b..28a19e67eefeaa78495d58e0f97a381fd001e4df 100644 (file)
@@ -10069,6 +10069,10 @@ static struct TokenInfo server_setup_tokens[] =
     TYPE_SWITCH,
     &setup.provide_uploading_tapes, TEST_PREFIX        "provide_uploading_tapes"
   },
+  {
+    TYPE_SWITCH,
+    &setup.ask_for_using_api_server,TEST_PREFIX        "ask_for_using_api_server"
+  },
 };
 
 static struct TokenInfo editor_setup_tokens[] =
@@ -10871,6 +10875,7 @@ static void setSetupInfoToDefaults_ServerSetup(struct SetupInfo *si)
   si->api_server_password = getStringCopy(UNDEFINED_PASSWORD);
   si->ask_for_uploading_tapes = TRUE;
   si->provide_uploading_tapes = TRUE;
+  si->ask_for_using_api_server = TRUE;
 }
 
 static void setSetupInfoToDefaults_EditorCascade(struct SetupInfo *si)
index 3cdb836d6764910ff3c28f8a359ebac8e03a128b..d4cc5ea8e0c5572bb737e62cb9202bdad128b344 100644 (file)
@@ -5146,6 +5146,24 @@ void NewHighScore(int level_nr, boolean tape_saved)
     return;
 
   SaveScoreTape(level_nr);
+
+  if (setup.ask_for_using_api_server)
+  {
+    setup.use_api_server =
+      Request("Upload your score and tape to the high score server?", REQ_ASK);
+
+    if (!setup.use_api_server)
+      Request("Not using high score server! Use setup menu to enable again!",
+             REQ_CONFIRM);
+
+    runtime.use_api_server = setup.use_api_server;
+
+    // after asking for using API server once, do not ask again
+    setup.ask_for_using_api_server = FALSE;
+
+    SaveSetup_ServerSetup();
+  }
+
   SaveServerScore(level_nr, tape_saved);
 }
 
index 11c88762ff96f9fbd2dd275050b57fd1bbe25d9d..d9b42321ba46b4ee59fb9936ded83414a197a8b7 100644 (file)
@@ -1515,6 +1515,7 @@ struct SetupInfo
   char *api_server_password;
   boolean ask_for_uploading_tapes;
   boolean provide_uploading_tapes;
+  boolean ask_for_using_api_server;
 
   struct SetupAutoSetupInfo auto_setup;
   struct SetupLevelSetupInfo level_setup;