diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9f5445a02..796683f36 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/include/extern.h b/include/extern.h index cb8ded8fc..784ce7f32 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/src/apply.c b/src/apply.c index 28b458f0c..7233d8ae4 100644 --- a/src/apply.c +++ b/src/apply.c @@ -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); } diff --git a/src/dig.c b/src/dig.c index 64a8e30cc..5e2e18229 100644 --- 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 */