UltraRogue: add the autosave feature.
UltraRogue now automatically saves the game when SIGHUP or SIGTERM is received.
This commit is contained in:
parent
8c77aafa62
commit
6c46840eab
4 changed files with 62 additions and 0 deletions
|
|
@ -115,6 +115,18 @@ save_savedir_game(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
auto_save(int sig)
|
||||
{
|
||||
FILE *savef;
|
||||
|
||||
md_ignore_signals();
|
||||
if (file_name[0] && (savef = fopen(file_name, "w"))) {
|
||||
save_file(savef);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
restore(char *file)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue