From: Holger Schemel Date: Sat, 3 Jul 2021 11:37:00 +0000 (+0200) Subject: added support for saving specified score tape file to server X-Git-Tag: 4.3.0.0~111 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=cbeca34e1c932720f2a3a7b6ae3614d27b774de7;p=rocksndiamonds.git added support for saving specified score tape file to server --- diff --git a/src/files.c b/src/files.c index 6b6078ba..1dd328c0 100644 --- a/src/files.c +++ b/src/files.c @@ -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) diff --git a/src/files.h b/src/files.h index c788bfcb..fd421ef1 100644 --- a/src/files.h +++ b/src/files.h @@ -66,6 +66,7 @@ void SaveScore(int); void LoadServerScore(int, boolean); void SaveServerScore(int); +void SaveServerScoreFromFile(int, char *); void LoadLocalAndServerScore(int, boolean);