struct ApiAddScoreThreadData
{
int level_nr;
+ boolean tape_saved;
char *score_tape_filename;
struct ScoreEntry score_entry;
};
-static void *CreateThreadData_ApiAddScore(int nr, char *score_tape_filename)
+static void *CreateThreadData_ApiAddScore(int nr, boolean tape_saved,
+ char *score_tape_filename)
{
struct ApiAddScoreThreadData *data =
checked_malloc(sizeof(struct ApiAddScoreThreadData));
score_tape_filename = getScoreTapeFilename(score_entry->tape_basename, nr);
data->level_nr = nr;
+ data->tape_saved = tape_saved;
data->score_entry = *score_entry;
data->score_tape_filename = getStringCopy(score_tape_filename);
struct ApiAddScoreThreadData *data = data_raw;
struct ScoreEntry *score_entry = &data->score_entry;
char *score_tape_filename = data->score_tape_filename;
+ boolean tape_saved = data->tape_saved;
int level_nr = data->level_nr;
request->hostname = setup.api_server_hostname;
" \"score\": \"%d\",\n"
" \"time\": \"%d\",\n"
" \"tape_basename\": \"%s\",\n"
+ " \"tape_saved\": \"%d\",\n"
" \"tape\": \"%s\"\n"
"}\n",
getPasswordJSON(setup.api_server_password),
score_entry->score,
score_entry->time,
score_entry->tape_basename,
+ tape_saved,
tape_base64);
checked_free(tape_base64);
return 0;
}
-static void ApiAddScoreAsThread(int nr, char *score_tape_filename)
+static void ApiAddScoreAsThread(int nr, boolean tape_saved,
+ char *score_tape_filename)
{
struct ApiAddScoreThreadData *data =
- CreateThreadData_ApiAddScore(nr, score_tape_filename);
+ CreateThreadData_ApiAddScore(nr, tape_saved, score_tape_filename);
ExecuteAsThread(ApiAddScoreThread,
"ApiAddScore", data,
"upload score to server");
}
-void SaveServerScore(int nr)
+void SaveServerScore(int nr, boolean tape_saved)
{
if (!runtime.use_api_server)
return;
- ApiAddScoreAsThread(nr, NULL);
+ ApiAddScoreAsThread(nr, tape_saved, NULL);
}
-void SaveServerScoreFromFile(int nr, char *score_tape_filename)
+void SaveServerScoreFromFile(int nr, boolean tape_saved,
+ char *score_tape_filename)
{
if (!runtime.use_api_server)
return;
- ApiAddScoreAsThread(nr, score_tape_filename);
+ ApiAddScoreAsThread(nr, tape_saved, score_tape_filename);
}
void LoadLocalAndServerScore(int nr, boolean download_score)
void Bang(int, int);
void InitMovDir(int, int);
void InitAmoebaNr(int, int);
-void NewHighScore(int);
+void NewHighScore(int, boolean);
void TestIfGoodThingHitsBadThing(int, int, int);
void TestIfBadThingHitsGoodThing(int, int, int);
{
// used instead of "level_nr" (needed for network games)
int last_level_nr = levelset.level_nr;
+ boolean tape_saved = FALSE;
game.LevelSolved_GameEnd = TRUE;
if (!global.use_envelope_request)
CloseDoor(DOOR_CLOSE_1);
- SaveTapeChecked_LevelSolved(tape.level_nr); // ask to save tape
+ // ask to save tape
+ tape_saved = SaveTapeChecked_LevelSolved(tape.level_nr);
// set unique basename for score tape (also saved in high score table)
strcpy(tape.score_tape_basename, getScoreTapeBasename(setup.player_name));
}
// save score and score tape before potentially erasing tape below
- NewHighScore(last_level_nr);
+ NewHighScore(last_level_nr, tape_saved);
if (setup.increment_levels &&
level_nr < leveldir_current->last_level &&
return -1;
}
-void NewHighScore(int level_nr)
+void NewHighScore(int level_nr, boolean tape_saved)
{
struct ScoreEntry new_entry = {{ 0 }}; // (prevent warning from GCC bug 53119)
boolean one_per_name = FALSE;
if (game.LevelSolved_SaveTape)
{
SaveScoreTape(level_nr);
- SaveServerScore(level_nr);
+ SaveServerScore(level_nr, tape_saved);
}
}