perm_invent initialization fix
Using |OPTIONS=windowtype:Foo |OPTIONS=perm_invent or |NETHACKOPTIONS='perm_invent,windowtype:Foo' would enable perm_invent if interface "Foo" supported it, but using |OPTIONS=perm_invent |OPTIONS=windowtype:Foo or |NETHACKOPTIONS='windowtype:Foo,perm_invent' or combined |OPTIONS=perm_invent |NETHACKOPTIONS='windowtype:Foo' would only enable perm_invent if both "Foo" and the default interface supported it. Using '--windowtyp:Foo' on the command line didn't have this issue because command line interface selection replaces the default one before configuration file and environment options are processed.
This commit is contained in:
@@ -1887,6 +1887,9 @@ OPTIONS=symset:blank and symset:plain didn't load the specified symbols if
|
|||||||
for OPTIONS=symset:blank, S_engroom (engraving on a room floor spot) and
|
for OPTIONS=symset:blank, S_engroom (engraving on a room floor spot) and
|
||||||
S_engrcorr (engraving on a corridor spot) retained their default
|
S_engrcorr (engraving on a corridor spot) retained their default
|
||||||
symbols ('`' and '#', respectively) instead of switching to space
|
symbols ('`' and '#', respectively) instead of switching to space
|
||||||
|
setting perm_invent in RC file before setting windowtype (whether later in
|
||||||
|
that file or via NETHACKOPTIONS) could result in it staying False
|
||||||
|
depending upon whether the default windowtype supported it
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
|
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
|
||||||
|
|||||||
@@ -4970,6 +4970,7 @@ optfn_boolean(
|
|||||||
}
|
}
|
||||||
if (req == do_set) {
|
if (req == do_set) {
|
||||||
boolean nosexchange = FALSE;
|
boolean nosexchange = FALSE;
|
||||||
|
int ln = 0;
|
||||||
|
|
||||||
if (!allopt[optidx].addr)
|
if (!allopt[optidx].addr)
|
||||||
return optn_ok; /* silent retreat */
|
return optn_ok; /* silent retreat */
|
||||||
@@ -4984,8 +4985,6 @@ optfn_boolean(
|
|||||||
|
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
if (op != empty_optstr) {
|
if (op != empty_optstr) {
|
||||||
int ln;
|
|
||||||
|
|
||||||
if (negated) {
|
if (negated) {
|
||||||
config_error_add(
|
config_error_add(
|
||||||
"Negated boolean '%s' should not have a parameter",
|
"Negated boolean '%s' should not have a parameter",
|
||||||
@@ -5018,7 +5017,7 @@ optfn_boolean(
|
|||||||
/* Before the change */
|
/* Before the change */
|
||||||
switch (optidx) {
|
switch (optidx) {
|
||||||
case opt_female:
|
case opt_female:
|
||||||
if (!strncmpi(opts, "female", 3)) {
|
if (!strncmpi(opts, "female", max(ln, 3))) {
|
||||||
if (!go.opt_initial && flags.female == negated) {
|
if (!go.opt_initial && flags.female == negated) {
|
||||||
nosexchange = TRUE;
|
nosexchange = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@@ -5026,7 +5025,7 @@ optfn_boolean(
|
|||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strncmpi(opts, "male", 3)) {
|
if (!strncmpi(opts, "male", max(ln, 3))) {
|
||||||
if (!go.opt_initial && flags.female != negated) {
|
if (!go.opt_initial && flags.female != negated) {
|
||||||
nosexchange = TRUE;
|
nosexchange = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@@ -5036,7 +5035,7 @@ optfn_boolean(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case opt_perm_invent:
|
case opt_perm_invent:
|
||||||
if (!negated && !can_set_perm_invent())
|
if (!negated && !go.opt_initial && !can_set_perm_invent())
|
||||||
return optn_silenterr;
|
return optn_silenterr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -5231,6 +5230,7 @@ can_set_perm_invent(void)
|
|||||||
* and is about to be changed to True.
|
* and is about to be changed to True.
|
||||||
*/
|
*/
|
||||||
uchar old_perminv_mode = iflags.perminv_mode;
|
uchar old_perminv_mode = iflags.perminv_mode;
|
||||||
|
|
||||||
if (!(windowprocs.wincap & WC_PERM_INVENT)) {
|
if (!(windowprocs.wincap & WC_PERM_INVENT)) {
|
||||||
#ifdef TTY_GRAPHICS
|
#ifdef TTY_GRAPHICS
|
||||||
#ifdef TTY_PERM_INVENT
|
#ifdef TTY_PERM_INVENT
|
||||||
@@ -5239,7 +5239,7 @@ can_set_perm_invent(void)
|
|||||||
if (!check_tty_wincap(WC_PERM_INVENT))
|
if (!check_tty_wincap(WC_PERM_INVENT))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return FALSE; /* should never happen */
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iflags.perminv_mode == InvOptNone)
|
if (iflags.perminv_mode == InvOptNone)
|
||||||
@@ -7122,6 +7122,21 @@ initoptions_finish(void)
|
|||||||
apply_customizations_to_symset(gc.currentgraphics);
|
apply_customizations_to_symset(gc.currentgraphics);
|
||||||
#endif
|
#endif
|
||||||
go.opt_initial = FALSE;
|
go.opt_initial = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do these after clearing the 'opt_initial' flag.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* player's RC file might try to enable perm_invent before selecting
|
||||||
|
current interface, so the decision then would have been based on
|
||||||
|
default interface; re-check with the active interface now */
|
||||||
|
if (iflags.perm_invent) {
|
||||||
|
/* can_set_perm_invent() expects to be called when perm_invent
|
||||||
|
is about to be toggled On, so start with it Off */
|
||||||
|
iflags.perm_invent = FALSE;
|
||||||
|
if (can_set_perm_invent())
|
||||||
|
iflags.perm_invent = TRUE;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user