autounlock overhaul

This gives the player more control over what autounlock does.  It is
now a compound option rather than a boolean, and takes values of
  autounlock:none
  !autounlock or noautounlock (shortcuts for none)
  autounlock:untrap + apply-key + kick + force (spaces are optional
    or can be used instead of plus-signs, but can't mix "foo bar+quux")
  autounlock (without a value, shortcut for autounlock:apply-key).
Default is autounlock:apply-key.

Untrap isn't implemented (feel free to jump in) so is suppressed from
the 'O' command's new sub-menu for autounlock.  It's parsed and
accepted from .nethackrc but won't accomplish anything.

[Just musing: it should be feasible to kick in direction '.' to break
open a container or #force to an adjacent spot to break open a door.
If that was done, autounlock:kick+force (or more likely autounlock:
apply-key+kick+force when lacking a key) would resort to force if hero
couldn't kick due to wounded legs or riding.

This changes struct flags so increments EDITLEVEL again.

This includes pull requests #750 from entrez and #751 from FIQ but was
entered from scratch rather than using use their commits.

Closes #750
Closes #751
This commit is contained in:
PatR
2022-05-04 19:13:28 -07:00
parent d1b14e08c4
commit 44d5be6eb4
9 changed files with 282 additions and 31 deletions

View File

@@ -20,7 +20,6 @@ struct flag {
boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */
boolean autoopen; /* open doors by walking into them */
boolean autounlock; /* automatically apply unlocking tools */
boolean beginner; /* True early in each game; affects feedback */
boolean biff; /* enable checking for mail */
boolean bones; /* allow saving/loading bones */
@@ -63,6 +62,11 @@ struct flag {
boolean tombstone; /* print tombstone */
boolean verbose; /* max battle info */
int end_top, end_around; /* describe desired score list */
unsigned autounlock; /* locked door/chest action */
#define AUTOUNLOCK_UNTRAP 1
#define AUTOUNLOCK_APPLY_KEY 2
#define AUTOUNLOCK_KICK 4
#define AUTOUNLOCK_FORCE 8
unsigned moonphase;
unsigned long suppress_alert;
#define NEW_MOON 0

View File

@@ -124,8 +124,11 @@ opt_##a,
set_in_game, No, Yes, No, NoAlias, "edit autopickup exceptions")
NHOPTB(autoquiver, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&flags.autoquiver)
NHOPTB(autounlock, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&flags.autounlock)
NHOPTC(autounlock,
(sizeof "none" + sizeof "untrap" + sizeof "apply-key"
+ sizeof "kick" + sizeof "force" + 20),
opt_out, set_in_game, Yes, Yes, No, Yes, NoAlias,
"action to take when encountering locked door or chest")
#if defined(MICRO) && !defined(AMIGA)
NHOPTB(BIOS, 0, opt_in, set_in_config, Off, Yes, No, No, NoAlias,
&iflags.BIOS)

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 57
#define EDITLEVEL 58
/*
* Development status possibilities.