]> granicus.if.org Git - nethack/commitdiff
from <Someone>'s list: destroy wand of digging
authornethack.allison <nethack.allison>
Thu, 16 Oct 2003 02:36:26 +0000 (02:36 +0000)
committernethack.allison <nethack.allison>
Thu, 16 Oct 2003 02:36:26 +0000 (02:36 +0000)
20000922    Water should flow into pits from broken WoD, or DoE.

This addresses the Wand of Digging part, but does not
do anything about Drum of Earthquake.

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

index 9f5445a02b130ea467ec95f0b891ed8da592984a..796683f36fe383e54665ea13cf7e67672ba0155b 100644 (file)
@@ -38,6 +38,7 @@ don't place randomly-placed aquatic monsters in lava on special levels
 hiding monsters don't hide under cockatrice/chickatrice corpses
 "sound" option renamed to "acoustics"
 deafness now a full-fledged attribute
+water should flow into pits from broken wand of digging
 
 
 Platform- and/or Interface-Specific Fixes
index cb8ded8fcc905872b9ca8a8d4947ae3697bd3e7a..784ce7f32645fff113f892a7d66ddea35ca50b94 100644 (file)
@@ -245,6 +245,8 @@ E void FDECL(rot_corpse, (genericptr_t, long));
 E struct obj *FDECL(buried_ball, (coord *));
 E void NDECL(buried_ball_to_punishment);
 E void NDECL(buried_ball_to_freedom);
+E schar FDECL(fillholetyp, (int, int));
+E void FDECL(liquid_flow, (XCHAR_P,XCHAR_P,SCHAR_P,struct trap *, const char *));
 #if 0
 E void FDECL(bury_monst, (struct monst *));
 E void NDECL(bury_you);
index 28b458f0c987a6b5d09003b98d0618c6dad92181..7233d8ae45bb0b653351efddad005484391f86fe 100644 (file)
@@ -2608,6 +2608,7 @@ do_break_wand(obj)
     int dmg, damage;
     boolean affects_objects;
     boolean shop_damage = FALSE;
+    boolean fillmsg = FALSE;
     int expltype = EXPL_MAGICAL;
     char confirm[QBUFSZ], the_wand[BUFSZ], buf[BUFSZ];
 
@@ -2697,14 +2698,23 @@ do_break_wand(obj)
        if (!isok(x,y)) continue;
 
        if (obj->otyp == WAN_DIGGING) {
+           schar typ;
            if(dig_check(BY_OBJECT, FALSE, x, y)) {
                if (IS_WALL(levl[x][y].typ) || IS_DOOR(levl[x][y].typ)) {
                    /* normally, pits and holes don't anger guards, but they
                     * do if it's a wall or door that's being dug */
                    watch_dig((struct monst *)0, x, y, TRUE);
                    if (*in_rooms(x,y,SHOPBASE)) shop_damage = TRUE;
-               }                   
-               digactualhole(x, y, BY_OBJECT,
+               }
+               typ = fillholetyp(x,y); 
+               if (typ != ROOM) {
+                       levl[x][y].typ = typ;
+                       liquid_flow(x, y, typ, t_at(x,y),
+                               fillmsg ? (char *)0 :
+                               "Some holes are quickly filled with %s!");
+                       fillmsg = TRUE;
+               } else
+                       digactualhole(x, y, BY_OBJECT,
                              (rn2(obj->spe) < 3 || !Can_dig_down(&u.uz)) ?
                               PIT : HOLE);
            }
index 64a8e30cce1de61a7ffeb2e63fae2e9d2c608600..5e2e182292e00248f679ccc5354bea33a0b320fd 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -13,7 +13,6 @@ 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 schar FDECL(fillholetyp, (int, int));
 STATIC_DCL void NDECL(dig_up_grave);
 
 /* Indices returned by dig_typ() */
@@ -438,7 +437,6 @@ holetime()
 }
 
 /* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
-STATIC_OVL
 schar
 fillholetyp(x,y)
 int x, y;
@@ -644,6 +642,32 @@ int ttyp;
        }
 }
 
+/*
+ * Called from dighole(), but also from do_break_wand()
+ * in apply.c.
+ */
+void
+liquid_flow(x, y, typ, ttmp, fillmsg)
+xchar x,y;
+schar typ;
+struct trap *ttmp;
+const char *fillmsg;
+{
+       boolean u_spot = (x == u.ux && y == u.uy);
+
+       if (ttmp) (void) delfloortrap(ttmp);
+       /* if any objects were frozen here, they're released now */
+       unearth_objs(x, y);
+
+       if (fillmsg) pline(fillmsg, typ == LAVAPOOL ? "lava" : "water");
+       if (u_spot && !(Levitation || Flying)) {
+           if (typ == LAVAPOOL)
+               (void) lava_effects();
+           else if (!Wwalking)
+               (void) drown();
+       }
+}
+
 /* return TRUE if digging succeeded, FALSE otherwise */
 boolean
 dighole(pit_only)
@@ -718,20 +742,8 @@ boolean pit_only;
 
                lev->drawbridgemask &= ~DB_UNDER;
                lev->drawbridgemask |= (typ == LAVAPOOL) ? DB_LAVA : DB_MOAT;
-
- liquid_flow:
-               if (ttmp) (void) delfloortrap(ttmp);
-               /* if any objects were frozen here, they're released now */
-               unearth_objs(u.ux, u.uy);
-
-               pline("As you dig, the hole fills with %s!",
-                     typ == LAVAPOOL ? "lava" : "water");
-               if (!Levitation && !Flying) {
-                   if (typ == LAVAPOOL)
-                       (void) lava_effects();
-                   else if (!Wwalking)
-                       (void) drown();
-               }
+               liquid_flow(u.ux, u.uy, typ, ttmp,
+                               "As you dig, the hole fills with %s!");
                return TRUE;
 
        /* the following two are here for the wand of digging */
@@ -746,7 +758,9 @@ boolean pit_only;
 
                if (typ != ROOM) {
                        lev->typ = typ;
-                       goto liquid_flow;
+                       liquid_flow(u.ux, u.uy, typ, ttmp,
+                               "As you dig, the hole fills with %s!");
+                       return TRUE;
                }
 
                /* finally we get to make a hole */