From: arromdee Date: Tue, 15 Jan 2002 02:50:36 +0000 (+0000) Subject: This adds in 's autodig patch. X-Git-Tag: MOVE2GIT~3474 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b6b5d7b8cc34176d8a7ea6a6c2d9c5736ea57e3;p=nethack This adds in 's autodig patch. --- diff --git a/dat/opthelp b/dat/opthelp index 58848482d..c7000da68 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -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] diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 6143551de..adea4dc50 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -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 " diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 8f91d337b..3a86fc120 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -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 diff --git a/doc/fixes33.2 b/doc/fixes33.2 index 7c84c90d5..c837903e6 100644 --- a/doc/fixes33.2 +++ b/doc/fixes33.2 @@ -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) diff --git a/include/extern.h b/include/extern.h index 7e5f7ee03..9f9b8fab0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/include/flag.h b/include/flag.h index 67d044ca6..aee46d244 100644 --- a/include/flag.h +++ b/include/flag.h @@ -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 diff --git a/src/dig.c b/src/dig.c index 7664c9ac8..740f1d66c 100644 --- 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) { diff --git a/src/hack.c b/src/hack.c index 9639c6fbd..61d3ad5f6 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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)) diff --git a/src/options.c b/src/options.c index 5e256906a..5b7a72fda 100644 --- a/src/options.c +++ b/src/options.c @@ -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)