rogue4: prevent changing name or save file when using system savedir

This commit is contained in:
John "Elwin" Edwards 2009-10-31 13:20:00 +00:00
parent 18a08fce7e
commit f433b66dc8
2 changed files with 48 additions and 3 deletions

View file

@ -32,6 +32,7 @@ STAT sbuf;
* save_game:
* Implement the "save game" command
*/
/* This has to be cleaned up, these goto's are annoying. */
save_game()
{
register FILE *savef;
@ -67,6 +68,14 @@ over:
}
}
if (use_savedir)
{
/* You can't change the savefile if you're using the system
savedir, because that means you have privileges. */
msg("");
return FALSE;
}
do
{
mpos = 0;
@ -102,7 +111,11 @@ gotfile:
}
strcpy(file_name, buf);
if ((savef = fopen(file_name, "w")) == NULL)
{
msg(strerror(errno)); /* fake perror() */
if (use_savedir)
return FALSE;
}
} while (savef == NULL);
/*