added sending timestamp of batch tape uploads to score server
authorHolger Schemel <info@artsoft.org>
Sun, 12 Sep 2021 11:13:45 +0000 (13:13 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 12 Sep 2021 11:20:06 +0000 (13:20 +0200)
src/files.c
src/main.h
src/tape.c

index 1ff0a4d5d2aad6497a197dca087460d5f610dda4..c14d8396c8306ed4a44f43df3a526bab91feb35d 100644 (file)
@@ -9358,6 +9358,7 @@ static void UploadScoreToServerExt(struct HttpRequest *request,
           "{\n"
           "%s"
           "  \"game_version\":         \"%s\",\n"
+          "  \"batch_time\":           \"%d\",\n"
           "  \"levelset_identifier\":  \"%s\",\n"
           "  \"levelset_name\":        \"%s\",\n"
           "  \"levelset_author\":      \"%s\",\n"
@@ -9376,6 +9377,7 @@ static void UploadScoreToServerExt(struct HttpRequest *request,
           "}\n",
           getPasswordJSON(setup.api_server_password),
           getProgramRealVersionString(),
+          (int)global.autoplay_time,
           levelset_identifier,
           levelset_name,
           levelset_author,
index f29e8b128b080e2d8763154a6707e963c687f0f1..bdb2836c0d6f078d434d9c88812c218d64053d8c 100644 (file)
@@ -3270,6 +3270,7 @@ struct GlobalInfo
   int autoplay_level[MAX_TAPES_PER_SET];
   int autoplay_mode;
   boolean autoplay_all;
+  time_t autoplay_time;
 
   char *patchtapes_mode;
   char *patchtapes_leveldir;
index cb6a9f9271b6b3f08d614f3c7a6b8ea7b72c581c..e7a87852f7fa15411d40631513cfeb60f99c4666 100644 (file)
@@ -1615,6 +1615,9 @@ static int AutoPlayTapesExt(boolean initialize)
     if (global.autoplay_mode == AUTOPLAY_MODE_FIX)
       options.mytapes = TRUE;
 
+    // set timestamp for batch tape upload
+    global.autoplay_time = time(NULL);
+
     num_tapes = 0;
 
     init_level_set = TRUE;
@@ -1823,6 +1826,9 @@ static int AutoPlayTapesExt(boolean initialize)
     return num_tapes;
   }
 
+  // clear timestamp for batch tape upload (required after interactive upload)
+  global.autoplay_time = 0;
+
   if (program.headless)
     CloseAllAndExit(0);