water_damage() band-aid
I got "The chain mail rusts." seemingly out of the blue, then when moving around the corner of the building on Valk home level I saw a spot of remembered ice be redrawn as water. Before that I checked for any mapped objects (via ';' 'o' 'o' ... so I didn't overlook anything; there were only a couple of objects shown on the map and none of them were piles) and didn't see any remembered chail mail or anything at all on that ice spot, so I'm assuming that it was carried by a monster. I may be leaving out some steps in the call chain here: melt_ice -> minliquid -> mondead -> m_detach -> relobj -> mdrop_obj -> flooreffects -> water_damage -> erode_obj erode_obj() uses bhitpos for visibility check of eroding objects not carried by the hero or by a monster, with a comment expressing doubt about doing that. It wouldn't have yielded the right answer for the possible call chain here unless it got set by some monster activity. I had been zapping a wand just before and bhitpos would have been set to a coordinate I could see at the time, fooling erode_obj()'s check if the value was stale. Anyway, this only addresses objects eroded from flooreffects(), water_damage_chain(), and fire_damage_chain(). There are lots of other indirect calls to erode_obj().
This commit is contained in:
4
src/do.c
4
src/do.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 do.c $NHDT-Date: 1582155879 2020/02/19 23:44:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.228 $ */
|
||||
/* NetHack 3.6 do.c $NHDT-Date: 1586285681 2020/04/07 18:54:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.235 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -144,6 +144,8 @@ const char *verb;
|
||||
|
||||
/* make sure things like water_damage() have no pointers to follow */
|
||||
obj->nobj = obj->nexthere = (struct obj *) 0;
|
||||
/* erode_obj() needs this (called from water_damage() or lava_damage()) */
|
||||
g.bhitpos.x = x, g.bhitpos.y = y;
|
||||
|
||||
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
|
||||
return TRUE;
|
||||
|
||||
12
src/trap.c
12
src/trap.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 trap.c $NHDT-Date: 1582799195 2020/02/27 10:26:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.353 $ */
|
||||
/* NetHack 3.6 trap.c $NHDT-Date: 1586285683 2020/04/07 18:54:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.357 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -3424,6 +3424,10 @@ xchar x, y;
|
||||
struct obj *obj, *nobj;
|
||||
int num = 0;
|
||||
|
||||
/* erode_obj() relies on bhitpos if target objects aren't carried by
|
||||
the hero or a monster, to check visibility controlling feedback */
|
||||
g.bhitpos.x = x, g.bhitpos.y = y;
|
||||
|
||||
for (obj = chain; obj; obj = nobj) {
|
||||
nobj = here ? obj->nexthere : obj->nobj;
|
||||
if (fire_damage(obj, force, x, y))
|
||||
@@ -3676,12 +3680,18 @@ struct obj *obj;
|
||||
boolean here;
|
||||
{
|
||||
struct obj *otmp;
|
||||
xchar x, y;
|
||||
|
||||
/* initialize acid context: so far, neither seen (dknown) potions of
|
||||
acid nor unseen have exploded during this water damage sequence */
|
||||
g.acid_ctx.dkn_boom = g.acid_ctx.unk_boom = 0;
|
||||
g.acid_ctx.ctx_valid = TRUE;
|
||||
|
||||
/* erode_obj() relies on bhitpos if target objects aren't carried by
|
||||
the hero or a monster, to check visibility controlling feedback */
|
||||
if (get_obj_location(obj, &x, &y, CONTAINED_TOO))
|
||||
g.bhitpos.x = x, g.bhitpos.y = y;
|
||||
|
||||
for (; obj; obj = otmp) {
|
||||
otmp = here ? obj->nexthere : obj->nobj;
|
||||
water_damage(obj, (char *) 0, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user