Prevent changing name or savefile when SAVEDIR is used.
This commit is contained in:
parent
20d469d64f
commit
a90fd134ba
2 changed files with 29 additions and 7 deletions
|
|
@ -40,6 +40,10 @@ OPTION optlist[] = {
|
||||||
{ "file", "Save file: ", file_name }
|
{ "file", "Save file: ", file_name }
|
||||||
};
|
};
|
||||||
#define NUM_OPTS (sizeof optlist / sizeof (OPTION))
|
#define NUM_OPTS (sizeof optlist / sizeof (OPTION))
|
||||||
|
OPTION safeoptlist[] = {
|
||||||
|
{ "fruit", "Fruit: ", fruit },
|
||||||
|
};
|
||||||
|
#define NUM_SOPTS (sizeof safeoptlist / sizeof (OPTION))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* print and then set options from the terminal
|
* print and then set options from the terminal
|
||||||
|
|
@ -48,14 +52,25 @@ option()
|
||||||
{
|
{
|
||||||
reg OPTION *op;
|
reg OPTION *op;
|
||||||
reg int wh;
|
reg int wh;
|
||||||
|
OPTION *olist;
|
||||||
|
int olen;
|
||||||
|
|
||||||
|
if (use_savedir) {
|
||||||
|
olist = safeoptlist;
|
||||||
|
olen = NUM_SOPTS;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
olist = optlist;
|
||||||
|
olen = NUM_OPTS;
|
||||||
|
}
|
||||||
|
|
||||||
wclear(hw);
|
wclear(hw);
|
||||||
touchwin(hw);
|
touchwin(hw);
|
||||||
/*
|
/*
|
||||||
* Display current values of options
|
* Display current values of options
|
||||||
*/
|
*/
|
||||||
for (op = optlist; op < &optlist[NUM_OPTS]; op++) {
|
for (op = olist; op < &olist[olen]; op++) {
|
||||||
wh = op - optlist;
|
wh = op - olist;
|
||||||
mvwaddstr(hw, wh, 0, op->o_prompt);
|
mvwaddstr(hw, wh, 0, op->o_prompt);
|
||||||
mvwaddstr(hw, wh, 16, op->o_opt);
|
mvwaddstr(hw, wh, 16, op->o_opt);
|
||||||
}
|
}
|
||||||
|
|
@ -63,13 +78,13 @@ option()
|
||||||
* Set values
|
* Set values
|
||||||
*/
|
*/
|
||||||
wmove(hw, 0, 0);
|
wmove(hw, 0, 0);
|
||||||
for (op = optlist; op < &optlist[NUM_OPTS]; op++) {
|
for (op = olist; op < &olist[olen]; op++) {
|
||||||
wmove(hw, op - optlist, 16);
|
wmove(hw, op - olist, 16);
|
||||||
if ((wh = get_str(op->o_opt, hw))) {
|
if ((wh = get_str(op->o_opt, hw))) {
|
||||||
if (wh == QUIT)
|
if (wh == QUIT)
|
||||||
break;
|
break;
|
||||||
else if (op > optlist) {
|
else if (op > olist) {
|
||||||
wmove(hw, op - optlist, 0);
|
wmove(hw, op - olist, 0);
|
||||||
op -= 2;
|
op -= 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,10 @@ save_game()
|
||||||
|
|
||||||
mpos = 0;
|
mpos = 0;
|
||||||
if (file_name[0] != '\0') {
|
if (file_name[0] != '\0') {
|
||||||
msg("Save file (%s)? ", file_name);
|
if (use_savedir)
|
||||||
|
msg("Save game? (y/n) ");
|
||||||
|
else
|
||||||
|
msg("Save file (%s)? ", file_name);
|
||||||
do {
|
do {
|
||||||
c = wgetch(cw);
|
c = wgetch(cw);
|
||||||
if(c == ESCAPE) {
|
if(c == ESCAPE) {
|
||||||
|
|
@ -70,6 +73,10 @@ save_game()
|
||||||
if (c == 'y')
|
if (c == 'y')
|
||||||
goto gotfile;
|
goto gotfile;
|
||||||
}
|
}
|
||||||
|
if (use_savedir) {
|
||||||
|
msg("");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
msg("File name: ");
|
msg("File name: ");
|
||||||
mpos = 0;
|
mpos = 0;
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue