Fix missed collected stars after gameover

This commit is contained in:
Zerocker 2020-06-05 15:15:40 +09:00 committed by GitHub
parent aff081080b
commit ad92b93b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -153,7 +153,7 @@ static s32 write_text_save(s32 fileIndex) {
if (i == 0) { if (i == 0) {
stars = save_file_get_star_flags(fileIndex, -1); stars = save_file_get_star_flags(fileIndex, -1);
} else { } else {
stars = save_file_get_star_flags(fileIndex, i+15); stars = save_file_get_star_flags(fileIndex, i+14);
} }
starFlags = int_to_bin(stars); starFlags = int_to_bin(stars);
@ -191,6 +191,10 @@ static s32 write_text_save(s32 fileIndex) {
} }
fprintf(file, "area = %d\n", savedata->capArea); fprintf(file, "area = %d\n", savedata->capArea);
/* Update a backup */
bcopy(&gSaveBuffer.files[fileIndex][0], &gSaveBuffer.files[fileIndex][1],
sizeof(gSaveBuffer.files[fileIndex][1]));
fclose(file); fclose(file);
return 1; return 1;
} }
@ -240,7 +244,6 @@ static s32 read_text_save(s32 fileIndex) {
return -1; return -1;
} }
/* Parse main flags */ /* Parse main flags */
for (i = 1; i < NUM_FLAGS; i++) { for (i = 1; i < NUM_FLAGS; i++) {
value = ini_get(savedata, "flags", sav_flags[i]); value = ini_get(savedata, "flags", sav_flags[i]);