added support for saving specified score tape file to server
authorHolger Schemel <info@artsoft.org>
Sat, 3 Jul 2021 11:37:00 +0000 (13:37 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 3 Jul 2021 11:37:00 +0000 (13:37 +0200)
src/files.c
src/files.h

index 6b6078ba20128a87bdcb62905afa7df173464813..1dd328c0f1f4fa744d28e84e7deb19865bb3881a 100644 (file)
@@ -9419,12 +9419,14 @@ static int UploadScoreToServerThread(void *data_raw)
   return 0;
 }
 
-static void UploadScoreToServerAsThread(int nr)
+static void UploadScoreToServerAsThread(int nr, char *score_tape_filename)
 {
   struct UploadScoreToServerThreadData *data =
     checked_malloc(sizeof(struct UploadScoreToServerThreadData));
   struct ScoreEntry *score_entry = &scores.entry[scores.last_added];
-  char *score_tape_filename = getScoreTapeFilename(score_entry->tape_basename, nr);
+
+  if (score_tape_filename == NULL)
+    score_tape_filename = getScoreTapeFilename(score_entry->tape_basename, nr);
 
   data->level_nr = nr;
   data->score_entry = *score_entry;
@@ -9440,7 +9442,15 @@ void SaveServerScore(int nr)
   if (!runtime.api_server)
     return;
 
-  UploadScoreToServerAsThread(nr);
+  UploadScoreToServerAsThread(nr, NULL);
+}
+
+void SaveServerScoreFromFile(int nr, char *score_tape_filename)
+{
+  if (!runtime.api_server)
+    return;
+
+  UploadScoreToServerAsThread(nr, score_tape_filename);
 }
 
 void LoadLocalAndServerScore(int nr, boolean download_score)
index c788bfcb8c91472fb68beda86b3af95767f58b16..fd421ef19fb0e90f8955d01ef519a7e4b31ea1a7 100644 (file)
@@ -66,6 +66,7 @@ void SaveScore(int);
 
 void LoadServerScore(int, boolean);
 void SaveServerScore(int);
+void SaveServerScoreFromFile(int, char *);
 
 void LoadLocalAndServerScore(int, boolean);