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

Function liquid_flow

src/dig.c:831–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831DISABLE_WARNING_FORMAT_NONLITERAL
832
833/*
834 * Called from dighole(); also from do_break_wand() in apply.c
835 * and do_earthquake() in music.c.
836 */
837void
838liquid_flow(
839 coordxy x, coordxy y,
840 schar typ,
841 struct trap *ttmp,
842 const char *fillmsg)
843{
844 struct obj *objchain;
845 struct monst *mon;
846 boolean u_spot = u_at(x, y);
847
848 /* caller should have changed levl[x][y].typ to POOL, MOAT, or LAVA */
849 if (!is_pool_or_lava(x, y)) {
850 if (iflags.sanity_check) {
851 impossible("Insane liquid_flow(%d,%d,%s,%s).", x, y,
852 ttmp ? trapname(ttmp->ttyp, TRUE) : "no trap",
853 fillmsg ? fillmsg : "no mesg");
854 }
855 return;
856 }
857
858 if (ttmp)
859 (void) delfloortrap(ttmp); /* will untrap monster if one is here */
860 /* if any objects were frozen here, they're released now */
861 obj_ice_effects(x, y, TRUE);
862 unearth_objs(x, y);
863
864 if (fillmsg)
865 pline(fillmsg, hliquid(typ == LAVAPOOL ? "lava" : "water"));
866 /* handle object damage before hero damage; affects potential bones */
867 if ((objchain = svl.level.objects[x][y]) != 0) {
868 if (typ == LAVAPOOL)
869 fire_damage_chain(objchain, TRUE, TRUE, x, y);
870 else
871 water_damage_chain(objchain, TRUE);
872 }
873 /* damage to the hero */
874 if (u_spot) {
875 (void) pooleffects(FALSE);
876 } else if ((mon = m_at(x, y)) != 0) {
877 (void) minliquid(mon);
878 }
879}
880
881RESTORE_WARNING_FORMAT_NONLITERAL
882

Callers 5

digholeFunction · 0.85
pit_flowFunction · 0.85
do_pitFunction · 0.85
blow_up_landmineFunction · 0.85
do_break_wandFunction · 0.85

Calls 12

is_pool_or_lavaFunction · 0.85
trapnameFunction · 0.85
delfloortrapFunction · 0.85
obj_ice_effectsFunction · 0.85
unearth_objsFunction · 0.85
hliquidFunction · 0.85
fire_damage_chainFunction · 0.85
water_damage_chainFunction · 0.85
pooleffectsFunction · 0.85
minliquidFunction · 0.85
impossibleFunction · 0.70
plineFunction · 0.70

Tested by

no test coverage detected