Prevent changing name or save file when using system savedir

This commit is contained in:
John "Elwin" Edwards 2009-10-14 11:21:33 +00:00
parent 265ac56d38
commit 5cc5f36a58
2 changed files with 50 additions and 5 deletions

View file

@ -51,6 +51,10 @@ save_game()
msg("File name: %s", file_name);
goto gotfile;
}
if (use_savedir)
return FALSE;
/* because you're not allowed to change the savefile if
you're using the system savedir! */
}
do
@ -66,11 +70,15 @@ save_game()
strcpy(file_name, buf);
gotfile:
if ((savef = fopen(file_name, "w")) == NULL)
{
msg(strerror(errno)); /* fake perror() */
if (use_savedir)
return FALSE;
}
} while (savef == NULL);
/*
* write out encrpyted file (after a stat)
* write out encrypted file (after a stat)
* The fwrite is to force allocation of the buffer before the write
*/
if (save_file(savef) != 0)