MCPcopy Create free account
hub / github.com/NetHack/NetHack / water_damage_chain

Function water_damage_chain

src/trap.c:4854–4888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4852}
4853
4854void
4855water_damage_chain(
4856 struct obj *obj,
4857 boolean here)
4858{
4859 struct obj *otmp;
4860 coordxy x, y;
4861 coord save_bhitpos;
4862
4863 if (!obj)
4864 return;
4865
4866 /* initialize acid context: so far, neither seen (dknown) potions of
4867 acid nor unseen have exploded during this water damage sequence */
4868 ga.acid_ctx.dkn_boom = ga.acid_ctx.unk_boom = 0;
4869 ga.acid_ctx.ctx_valid = TRUE;
4870 /* we don't want to permanently overwrite bhitpos below, since we can get
4871 here from scenarios where it was in use up the call stack (e.g. thrown
4872 item hurtling the levitating hero into a wall of water) */
4873 save_bhitpos = gb.bhitpos;
4874 /* erode_obj() relies on bhitpos if target objects aren't carried by
4875 the hero or a monster, to check visibility controlling feedback */
4876 if (get_obj_location(obj, &x, &y, CONTAINED_TOO))
4877 gb.bhitpos.x = x, gb.bhitpos.y = y;
4878
4879 for (; obj; obj = otmp) {
4880 otmp = here ? obj->nexthere : obj->nobj;
4881 water_damage(obj, (char *) 0, FALSE);
4882 }
4883
4884 /* reset acid context and bhitpos */
4885 ga.acid_ctx.dkn_boom = ga.acid_ctx.unk_boom = 0;
4886 ga.acid_ctx.ctx_valid = FALSE;
4887 gb.bhitpos = save_bhitpos;
4888}
4889
4890/*
4891 * This function is potentially expensive - rolling

Callers 7

mcast_geyserFunction · 0.85
wizterrainwishFunction · 0.85
liquid_flowFunction · 0.85
minliquid_coreFunction · 0.85
water_damageFunction · 0.85
drownFunction · 0.85
gushFunction · 0.85

Calls 2

get_obj_locationFunction · 0.85
water_damageFunction · 0.85

Tested by

no test coverage detected