]> granicus.if.org Git - nethack/commitdiff
This adds in <Someone>'s autodig patch.
authorarromdee <arromdee>
Tue, 15 Jan 2002 02:50:36 +0000 (02:50 +0000)
committerarromdee <arromdee>
Tue, 15 Jan 2002 02:50:36 +0000 (02:50 +0000)
dat/opthelp
doc/Guidebook.mn
doc/Guidebook.tex
doc/fixes33.2
include/extern.h
include/flag.h
src/dig.c
src/hack.c
src/options.c

index 58848482d24bc6fb1a0ec1401f6be9de35e31c9f..c7000da6825d38c630fc5c0bad353c12363aaa67 100644 (file)
@@ -2,6 +2,7 @@ Boolean options not under specific compile flags (with default values in []):
 (You can learn which options exist in your version by checking your current
 option setting, which is reached via the 'O' cmd.)
 
+autodig        dig if moving and wielding digging tool            [FALSE]
 autopickup     automatically pick up objects you move over        [TRUE]
 autoquiver     when firing with an empty quiver, select some
                suitable inventory weapon to fill the quiver       [FALSE]
index 6143551de3c054de9238fa9018d29f0901452319..adea4dc500009a54a8b7504741093971d75645e8 100644 (file)
@@ -1596,6 +1596,9 @@ Your starting alignment (align:lawful, align:neutral,
 or align:chaotic).  You may specify just the first letter.
 The default is to randomly pick an appropriate alignment.
 Cannot be set with the `O' command.
+.lp autodig
+Automatically dig if you are wielding a digging tool and moving into a place
+that can be dug (default false).
 .lp "autopickup  "
 Automatically pick up things onto which you move (default on).
 .lp "autoquiver  "
index 8f91d337bfaf2659f153ff96f6c5aec72e6be6f8..3a86fc120b63e90a1f541c76cfc0547ef97dbe71 100644 (file)
@@ -2006,6 +2006,10 @@ or {\tt align:chaotic}).  You may specify just the first letter.
 The default is to randomly pick an appropriate alignment.
 Cannot be set with the `{\tt O}' command.
 %.lp
+\item[\ib{autodig}]
+Automatically dig if you are wielding a digging tool and moving into a place
+that can be dug (default false).
+%.lp
 \item[\ib{autopickup}]
 Automatically pick up things onto which you move (default on).
 %.Ip
index 7c84c90d565c074ab9fe7a6e6ba2757b09a93708..c837903e6dda8108b827af3c2a1cbbfcbc43d490 100644 (file)
@@ -469,6 +469,7 @@ blessed gold detection now detects anything made of gold, not just
        coins, including candelabrum and gold rings
 new T-shirt messages from Scott Bigham
 option to get rid of resistance 'sparkle' (shieldeffect) (Scott Bigham)
+option for autodig (Malcolm Ryan)
 glowing Sunsword (inspired by Slashem)
 msg_window option for ^P in TTY mode (Jay Tilton)
 ninjas should get multishot bonus with yumi and ya (Dylan O'Donnell)
index 7e5f7ee03d2c02725904677379ba4c6330baad12..9f9b8fab0fbce940608ed9864a7d3246d9976c68 100644 (file)
@@ -228,6 +228,7 @@ E boolean FDECL(dig_check, (struct monst *, BOOLEAN_P, int, int));
 E void FDECL(digactualhole, (int,int,struct monst *,int));
 E boolean FDECL(dighole, (BOOLEAN_P));
 E int FDECL(use_pick_axe, (struct obj *));
+E int FDECL(use_pick_axe2, (struct obj *));
 E boolean FDECL(mdig_tunnel, (struct monst *));
 E void FDECL(watch_dig, (struct monst *,XCHAR_P,XCHAR_P,BOOLEAN_P));
 E void NDECL(zap_dig);
index 67d044ca6ee1c61de5d3ed229905efc10ba21cd2..aee46d2443c7c7b0413478f4db0f67d9b3fb77f2 100644 (file)
@@ -22,6 +22,7 @@ struct flag {
 #ifdef MFLOPPY
        boolean  asksavedisk;
 #endif
+       boolean  autodig;       /* MRKR: Automatically dig */
        boolean  autoquiver;    /* Automatically fill quiver */
        boolean  beginner;
 #ifdef MAIL
index 7664c9ac8ace95d4b9f88c6f6d1618d917a1d228..740f1d66c0747b11491b4abaefc03feb74f03f7e 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -773,9 +773,8 @@ struct obj *obj;
        char dirsyms[12];
        char qbuf[QBUFSZ];
        register char *dsp = dirsyms;
-       register struct rm *lev;
        register int rx, ry;
-       int dig_target, res = 0;
+       int res = 0;
        register const char *sdp;
        if(iflags.num_pad) sdp = ndir; else sdp = sdir; /* DICE workaround */
 
@@ -804,6 +803,22 @@ struct obj *obj;
        Sprintf(qbuf, "In what direction do you want to dig? [%s]", dirsyms);
        if(!getdir(qbuf))
                return(res);
+
+       return(use_pick_axe2(obj));
+}
+
+/* MRKR: use_pick_axe() is split in two to allow autodig to bypass */
+/*       the "In what direction do you want to dig?" query.        */
+/*       use_pick_axe2() uses the existing u.dx, u.dy and u.dz    */
+
+int
+use_pick_axe2(obj) 
+struct obj *obj;
+{
+       register int rx, ry;
+       register struct rm *lev;
+       int dig_target;
+
        if (u.uswallow && attack(u.ustuck)) {
                ;  /* return(1) */
        } else if (Underwater) {
index 9639c6fbd8279b884799ddf0ec9f7fba84169be8..61d3ad5f68b86529bee1515ea85888e7aefcc13d 100644 (file)
@@ -545,6 +545,14 @@ boolean test_only;
        } else if (tunnels(youmonst.data) && !needspick(youmonst.data)) {
            /* Eat the rock. */
            if (!test_only && still_chewing(x,y)) return FALSE;
+       } else if (flags.autodig && !flags.run && !flags.nopick && (uwep->otyp == PICK_AXE || uwep->otyp == DWARVISH_MATTOCK)) {
+       /* MRKR: Automatic digging when wielding the appropriate tool */
+           if (!test_only) {
+               use_pick_axe2(uwep);
+               flags.move = 0;
+               nomul(0);
+               return FALSE;
+           }
        } else {
            if ( !test_only ) {
                if (Is_stronghold(&u.uz) && is_db_wall(x,y))
index 5e256906a337b077a39fdfb571180c49b8866a88..5b7a72fdae4d12db673ca45852cd6af5eeed8bfb 100644 (file)
@@ -39,6 +39,7 @@ static struct Bool_Opt
 #else
        {"asksavedisk", (boolean *)0, FALSE},
 #endif
+       {"autodig", &flags.autodig, FALSE},
        {"autopickup", &flags.pickup, TRUE},
        {"autoquiver", &flags.autoquiver, FALSE},
 #if defined(MICRO) && !defined(AMIGA)