From: PatR Date: Fri, 1 May 2020 07:42:18 +0000 (-0700) Subject: liquid_flow when digging pit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5457cbe0e37971104f4178aad995cb8cae85acd2;p=nethack liquid_flow when digging pit Part of github issue #338 that isn't about shops: objects at the spot where a dug pit fills with lava (or water) weren't being effected by that. While fixing it, I noticed that hero's steed wasn't affected either. Also, when conjoined pits are filled in, monsters other than the steed are at risk but weren't being handled. Presumably they fell in on their next move. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 7c9fd4680..eac27182f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -168,6 +168,9 @@ failed untrap while mounted that moved hero onto the trap would leave steed with stale coordinates, triggering warnings if 'sanity_check' is On when hold_another_object() fails while hero is swallowed, drop the item into swallower's inventory instead of onto the floor +when digging a pit results in it being filled by adjacent pool or lava, any + objects at the spot weren't subjected to water or fire damage; + also, riding hero's steed wasn't subjected to immersion either Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/dig.c b/src/dig.c index 05cdbbdd7..ad565aac7 100644 --- a/src/dig.c +++ b/src/dig.c @@ -739,6 +739,8 @@ schar typ; struct trap *ttmp; const char *fillmsg; { + struct obj *objchain; + struct monst *mon; boolean u_spot = (x == u.ux && y == u.uy); if (ttmp) @@ -748,11 +750,18 @@ const char *fillmsg; if (fillmsg) pline(fillmsg, hliquid(typ == LAVAPOOL ? "lava" : "water")); - if (u_spot && !(Levitation || Flying)) { + /* handle object damage before hero damage; affects potential bones */ + if ((objchain = g.level.objects[x][y]) != 0) { if (typ == LAVAPOOL) - (void) lava_effects(); - else if (!Wwalking) - (void) drown(); + fire_damage_chain(objchain, TRUE, TRUE, x, y); + else + water_damage_chain(objchain, TRUE); + } + /* damage to the hero */ + if (u_spot) { + (void) pooleffects(FALSE); + } else if ((mon = m_at(x, y)) != 0) { + (void) minliquid(mon); } } @@ -1685,6 +1694,12 @@ pit_flow(trap, filltyp) struct trap *trap; schar filltyp; { + /* + * FIXME? + * liquid_flow() -> pooleffects() -> {drown(),lava_effects()} + * might kill the hero; the game will end and if that leaves bones, + * remaining conjoined pits will be left unprocessed. + */ if (trap && filltyp != ROOM && is_pit(trap->ttyp)) { struct trap t; int idx;