]> granicus.if.org Git - nethack/commitdiff
Merge branch 'autounlock' of https://github.com/copperwater/NetHack into copperwater...
authornhmall <nhmall@nethack.org>
Wed, 2 Oct 2019 17:47:33 +0000 (13:47 -0400)
committernhmall <nhmall@nethack.org>
Wed, 2 Oct 2019 17:47:33 +0000 (13:47 -0400)
github pull request #228 commentary follows:

This adds a boolean option, autounlock, defaulting to true. When this is
set to TRUE, messages stating that some door or container is locked are
automatically followed by a prompt asking if you would like to unlock
it, if you are carrying an unlocking tool (key, lock pick, or credit
card).

Architecturally, this extends the pick_lock function to take three
additional arguments (door coordinates or a box on the ground you are
autounlocking).

Because this adds a new field to struct flag, this is not a
save-compatible change. I have not adjusted EDITLEVEL or
VERSION_COMPATIBILITY, though.

The code that selects an unlocking tool will always look first for a
skeleton key, then a lock pick, then a credit card. Since curses, rust,
and other attributes don't really have an effect on the viability of the
unlocking device, it didn't seem to warrant making a more complex
function for that.

closes #228

1  2 
doc/fixes37.0
include/extern.h
include/flag.h
src/apply.c
src/lock.c
src/options.c
src/pickup.c

diff --cc doc/fixes37.0
index 2e2f93d51f27c8638eb5cb797790b59bce2bb561,0000000000000000000000000000000000000000..8e82ed3457625dc16365306bd2df5eb2e0e4786c
mode 100644,000000..100644
--- /dev/null
@@@ -1,42 -1,0 +1,43 @@@
 +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ $NHDT-Date: 1557663358 2019/05/12 12:15:58 $
 +
 +General Fixes and Modified Features
 +-----------------------------------
 +fix compile when DLB isn't defined
 +hero polymorphed into a vampire can use #monster to shape-shift rather than
 +      just do a one-shot polymorph into bat/cloud/wolf and shifted vampire
 +      hero can use #monster again to take on another form (randomly chosen
 +      among the shiftable shapes and true vampire form)
 +
 +
 +Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository
 +------------------------------------------------------------------
 +
 +
 +Platform- and/or Interface-Specific Fixes
 +-----------------------------------------
 +
 +
 +General New Features
 +--------------------
 +if a killer bee encounters a lump of royal jelly and there is no queen bee on
 +      the level, the bee will eat the jelly and become a new queen
 +automatic annotation "gateway to Moloch's Sanctum" for vibrating square level
 +      once that square's location becomes known (found or magic mapped);
 +      goes away once sanctum temple is found (entered or high altar mapped)
 +
 +
 +Platform- and/or Interface-Specific New Features
 +------------------------------------------------
 +
 +
 +NetHack Community Patches (or Variation) Included
 +-------------------------------------------------
++autounlock feature originally from unnethack in github pull request #228
 +
 +
 +Code Cleanup and Reorganization
 +-------------------------------
 +move majority of global variables into instance_globals struct g
 +move zeroobj, zeromonst, zeroany into const_globals struct cg
 +remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR
 +
Simple merge
diff --cc include/flag.h
Simple merge
diff --cc src/apply.c
Simple merge
diff --cc src/lock.c
index 1ebb9cdac17729cd418322acf987acf141647374,8645b66a147e5aa74ee4f8070136de58e0483dcc..76922deb7004a86a413e18129dffb031ff646cdf
@@@ -371,8 -389,10 +380,10 @@@ struct obj *container; /* container, fo
  
          count = 0;
          c = 'n'; /* in case there are no boxes here */
 -        for (otmp = level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere)
 +        for (otmp = g.level.objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere)
-             if (Is_box(otmp)) {
+             /* autounlock on boxes: only the one that just informed you it was
+              * locked. Don't include any other boxes which might be here. */
+             if ((!autounlock && Is_box(otmp)) || (otmp == container)) {
                  ++count;
                  if (!can_reach_floor(TRUE)) {
                      You_cant("reach %s from up here.", the(xname(otmp)));
diff --cc src/options.c
Simple merge
diff --cc src/pickup.c
Simple merge