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 }
|
||||
};
|
||||
#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
|
||||
|
|
@ -48,14 +52,25 @@ option()
|
|||
{
|
||||
reg OPTION *op;
|
||||
reg int wh;
|
||||
OPTION *olist;
|
||||
int olen;
|
||||
|
||||
if (use_savedir) {
|
||||
olist = safeoptlist;
|
||||
olen = NUM_SOPTS;
|
||||
}
|
||||
else {
|
||||
olist = optlist;
|
||||
olen = NUM_OPTS;
|
||||
}
|
||||
|
||||
wclear(hw);
|
||||
touchwin(hw);
|
||||
/*
|
||||
* Display current values of options
|
||||
*/
|
||||
for (op = optlist; op < &optlist[NUM_OPTS]; op++) {
|
||||
wh = op - optlist;
|
||||
for (op = olist; op < &olist[olen]; op++) {
|
||||
wh = op - olist;
|
||||
mvwaddstr(hw, wh, 0, op->o_prompt);
|
||||
mvwaddstr(hw, wh, 16, op->o_opt);
|
||||
}
|
||||
|
|
@ -63,13 +78,13 @@ option()
|
|||
* Set values
|
||||
*/
|
||||
wmove(hw, 0, 0);
|
||||
for (op = optlist; op < &optlist[NUM_OPTS]; op++) {
|
||||
wmove(hw, op - optlist, 16);
|
||||
for (op = olist; op < &olist[olen]; op++) {
|
||||
wmove(hw, op - olist, 16);
|
||||
if ((wh = get_str(op->o_opt, hw))) {
|
||||
if (wh == QUIT)
|
||||
break;
|
||||
else if (op > optlist) {
|
||||
wmove(hw, op - optlist, 0);
|
||||
else if (op > olist) {
|
||||
wmove(hw, op - olist, 0);
|
||||
op -= 2;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue