UltraRogue: restrict changing name and save file.
When the -n option is in use, player name and save file location cannot be changed. The score file is also restricted.
This commit is contained in:
parent
7b42d453f0
commit
fc0b18d304
2 changed files with 103 additions and 3 deletions
|
|
@ -25,6 +25,8 @@
|
|||
#include <errno.h>
|
||||
#include "rogue.h"
|
||||
|
||||
int save_savedir_game(void);
|
||||
|
||||
int
|
||||
save_game(void)
|
||||
{
|
||||
|
|
@ -32,6 +34,9 @@ save_game(void)
|
|||
char buf[2 * LINELEN];
|
||||
char oldfile[2*LINELEN];
|
||||
|
||||
if (use_savedir)
|
||||
return save_savedir_game();
|
||||
|
||||
/* get file name */
|
||||
|
||||
strcpy(oldfile,file_name);
|
||||
|
|
@ -79,6 +84,37 @@ save_game(void)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* save_savedir_game()
|
||||
* Simplified save function for when system savefiles are used.
|
||||
*/
|
||||
int
|
||||
save_savedir_game(void)
|
||||
{
|
||||
FILE *savef;
|
||||
char c;
|
||||
|
||||
mpos = 0;
|
||||
msg("Save game? ");
|
||||
c = readcharw(cw);
|
||||
if (c == 'y' || c == 'Y')
|
||||
{
|
||||
if ((savef = fopen(file_name, "w")) == NULL)
|
||||
{
|
||||
msg(strerror(errno));
|
||||
return(FALSE);
|
||||
}
|
||||
msg("");
|
||||
save_file(savef);
|
||||
return(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("");
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
restore(char *file)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue