diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index b6375af04..f71d85287 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1070,6 +1070,8 @@ throwing recoil while levitating could send hero out of shop while carrying a step other than back into the shop was treated as a robbery if punished and iron ball was cursed and wielded--so welded to hand--falling when doors would drop it instead of keeping it welded +if player's run-time config file had OPTIONS=role:Val and the environment had + NETHACKOPTIONS='role:!Val' the hero would be a Val instead of !Val Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/options.c b/src/options.c index 036186b32..3f4c04dff 100644 --- a/src/options.c +++ b/src/options.c @@ -7477,6 +7477,7 @@ parse_role_opts( char *opts, char **opp) { + static char role_random[] = "random"; /* not 'const' but never modified */ char *op = *opp; boolean ok = FALSE; @@ -7535,6 +7536,8 @@ parse_role_opts( complain_about_duplicate(optidx); *opp = op; ok = TRUE; + /* don't return yet; value might be a list which follows + this with something else, making it invalid */ } if (sp) { @@ -7544,6 +7547,15 @@ parse_role_opts( op += strlen(op); /* break; */ } } + + if (!ok) { + /* '!ok' without config_error_add() implies a valid negation; + in case NETHACKOPTIONS=role:!Val overrides config file + OPTIONS=role:Val we need a positive result which will yield + someting other than ROLE_NONE from str2role(),str2race(),&c */ + *opp = role_random; + ok = TRUE; + } } return ok; }