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

@ -505,11 +505,18 @@ static void State_autosave(void) {
state_slot = last_state_slot;
}
static void State_resume(void) {
if (!exists(RESUME_SLOT_PATH)) return;
int last_state_slot = state_slot;
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_slot = last_state_slot;
}
@ -4357,6 +4364,7 @@ int main(int argc , char* argv[]) {
Menu_quit();
finish:
State_autosave();
Game_close();
Core_unload();