Autosave when quitting game (moronimo)

This commit is contained in:
Mauro Vietri 2023-05-29 08:25:35 -03:00
parent cc75c6ef03
commit 722d249916

View file

@ -504,12 +504,19 @@ static void State_autosave(void) {
State_write(); State_write();
state_slot = last_state_slot; state_slot = last_state_slot;
} }
static void State_resume(void) { static void State_resume(void) {
if (!exists(RESUME_SLOT_PATH)) return;
int last_state_slot = state_slot; int last_state_slot = state_slot;
state_slot = getInt(RESUME_SLOT_PATH);
unlink(RESUME_SLOT_PATH); if (exists(RESUME_SLOT_PATH)) {
state_slot = getInt(RESUME_SLOT_PATH);
unlink(RESUME_SLOT_PATH);
if( state_slot == 8 ) {
state_slot = AUTO_RESUME_SLOT;
}
} else {
state_slot = AUTO_RESUME_SLOT;
}
State_read(); State_read();
state_slot = last_state_slot; state_slot = last_state_slot;
} }
@ -4357,6 +4364,7 @@ int main(int argc , char* argv[]) {
Menu_quit(); Menu_quit();
finish: finish:
State_autosave();
Game_close(); Game_close();
Core_unload(); Core_unload();