]> granicus.if.org Git - nethack/commitdiff
more F move (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 19 Jul 2007 08:20:20 +0000 (08:20 +0000)
committernethack.rankin <nethack.rankin>
Thu, 19 Jul 2007 08:20:20 +0000 (08:20 +0000)
     Using F prefix when trying to move into a wall or closed door yielded
"you attack thin air".  Like the recently fixed F-vs-boulder case, give
more appropriate feedback.  Also like F-vs-boulder, initiate digging if
wielding a pick-axe.  (Also handles axes versus trees and closed doors).

     One thing which isn't handled but possibly should be:  F vs closed
door when not wielding a pick or other axe might attempt to force the door.
(Right now it gives "you harmlessly attack the door".)

doc/fixes35.0
include/extern.h
src/dig.c
src/hack.c

index 72f846472d212dbcfec128bb236e85baba3dab96..afefe3f9d75efa15f05302ea397d4741b8a649eb 100644 (file)
@@ -370,7 +370,7 @@ C and #name commands are now same and use menu to choose monster vs object
 hallucination provides partial protection against gaze attacks
 attempting to read "dull" spellbook might cause hero to fall asleep
 dipping prompt is more precise
-using F to attack boulder or statue while wielding pick digs/breaks target
+using F to attack wall/boulder/statue while wielding pick digs/breaks target
 
 
 Platform- and/or Interface-Specific New Features
index 0941937126ffa4535f70480d42fc6a7a19890de4..8fc407724ff489a00424efb51d7df0937146691a 100644 (file)
@@ -259,6 +259,7 @@ E void NDECL(sokoban_detect);
 
 /* ### dig.c ### */
 
+E int FDECL(dig_typ, (struct obj *,XCHAR_P,XCHAR_P));
 E boolean NDECL(is_digging);
 #ifdef USE_TRAMPOLI
 E int NDECL(dig);
index c7253d628b0080ef17958c17e455fe7e0dd7e5d7..c565918d03a335594fc0d03b38b0b901a5a5f794 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -11,7 +11,6 @@ static NEARDATA boolean did_dig_msg;
 STATIC_DCL boolean NDECL(rm_waslit);
 STATIC_DCL void FDECL(mkcavepos, (XCHAR_P,XCHAR_P,int,BOOLEAN_P,BOOLEAN_P));
 STATIC_DCL void FDECL(mkcavearea, (BOOLEAN_P));
-STATIC_DCL int FDECL(dig_typ, (struct obj *,XCHAR_P,XCHAR_P));
 STATIC_DCL int NDECL(dig);
 STATIC_DCL void FDECL(dig_up_grave, (coord *));
 STATIC_DCL int FDECL(adj_pit_checks, (coord *,char *));
@@ -129,12 +128,16 @@ register boolean rockit;
 }
 
 /* When digging into location <x,y>, what are you actually digging into? */
-STATIC_OVL int
+int
 dig_typ(otmp, x, y)
 struct obj *otmp;
 xchar x, y;
 {
-       boolean ispick = is_pick(otmp);
+       boolean ispick;
+
+       if (!otmp) return DIGTYP_UNDIGGABLE;
+       ispick = is_pick(otmp);
+       if (!ispick && !is_axe(otmp)) return DIGTYP_UNDIGGABLE;
 
        return (ispick && sobj_at(STATUE, x, y) ? DIGTYP_STATUE :
                ispick && sobj_at(BOULDER, x, y) ? DIGTYP_BOULDER :
index 82211bf4e334ca898afcd4c58dd07476c7a770c5..09a11eda4c382d159be26b039066fec573e5f85a 100644 (file)
@@ -1204,7 +1204,8 @@ domove()
            /* remembered an 'I' && didn't use a move command */
            (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
                struct obj *boulder = sobj_at(BOULDER, x, y);
-               boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL));
+               boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
+                       solid = !accessible(x, y);
                int glyph = glyph_at(x, y);     /* might be monster */
                char buf[BUFSZ];
 
@@ -1215,15 +1216,22 @@ domove()
                        (Hallucination && glyph_is_monster(glyph)))
                    boulder = sobj_at(STATUE, x, y);
 
-               /* force fight at boulder (or statue) while wielding pick:
-                  start digging to break the boulder (or statue) */
-               if (boulder && context.forcefight && uwep && is_pick(uwep)) {
+               /* force fight at boulder/statue or wall/door while wielding
+                  pick:  start digging to break the boulder or wall */
+               if (context.forcefight &&
+                       /* can we dig? */
+                       uwep && dig_typ(uwep, x, y) &&
+                       /* should we dig? */
+                       !glyph_is_invisible(glyph) &&
+                       !glyph_is_monster(glyph)) {
                    (void)use_pick_axe2(uwep);
                    return;
                }
 
                if (boulder)
                    Strcpy(buf, ansimpleoname(boulder));
+               else if (solid)
+                   Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
                else if (!Underwater)
                    Strcpy(buf, "thin air");
                else if (is_pool(x, y))
@@ -1231,7 +1239,8 @@ domove()
                else    /* Underwater, targetting non-water */
                    Sprintf(buf, "a vacant spot on the %s", surface(x,y));
                You("%s%s %s.",
-                   !boulder ? "" : !explo ? "harmlessly " : "futilely ",
+                   !(boulder || solid) ? "" :
+                       !explo ? "harmlessly " : "futilely ",
                    explo ? "explode at" : "attack",
                    buf);
                unmap_object(x, y); /* known empty -- remove 'I' if present */