From: Holger Schemel Date: Sat, 16 Apr 2022 23:11:28 +0000 (+0200) Subject: added storing score tapes from score server in cache directory X-Git-Tag: 4.3.2.0^0 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d0c35d05e88d7c3761c074135af990fc14302ace;p=rocksndiamonds.git added storing score tapes from score server in cache directory --- diff --git a/src/api.c b/src/api.c index f2679fa1..3e2b387e 100644 --- a/src/api.c +++ b/src/api.c @@ -651,7 +651,7 @@ static void *CreateThreadData_ApiGetScoreTape(int nr, int id, { struct ApiGetScoreTapeThreadData *data = checked_malloc(sizeof(struct ApiGetScoreTapeThreadData)); - char *score_tape_filename = getScoreTapeFilename(score_tape_basename, nr); + char *score_tape_filename = getScoreCacheTapeFilename(score_tape_basename, nr); data->level_nr = nr; data->score_id = id; @@ -716,7 +716,7 @@ static void HandleResponse_ApiGetScoreTape(struct HttpResponse *response, int i; // used instead of "leveldir_current->subdir" (for network games) - InitScoreTapeDirectory(levelset.identifier, level_nr); + InitScoreCacheTapeDirectory(levelset.identifier, level_nr); if (!(file = fopen(filename, MODE_WRITE))) { diff --git a/src/tape.c b/src/tape.c index 50335073..cd07263f 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1402,7 +1402,10 @@ static boolean PlayScoreTape_WaitForDownload(void) boolean PlayScoreTape(int entry_nr) { struct ScoreEntry *entry = &scores.entry[entry_nr]; - char *tape_filename = getScoreTapeFilename(entry->tape_basename, level_nr); + char *tape_filename = + (entry->id == -1 ? + getScoreTapeFilename(entry->tape_basename, level_nr) : + getScoreCacheTapeFilename(entry->tape_basename, level_nr)); boolean download_tape = (!fileExists(tape_filename)); if (download_tape && entry->id == -1) @@ -1439,7 +1442,10 @@ boolean PlayScoreTape(int entry_nr) // if tape recorder already contains a tape, remove it without asking TapeErase(); - LoadScoreTape(entry->tape_basename, level_nr); + if (entry->id == -1) + LoadScoreTape(entry->tape_basename, level_nr); + else + LoadScoreCacheTape(entry->tape_basename, level_nr); if (TAPE_IS_EMPTY(tape)) {