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

Function melt_ice

src/zap.c:5039–5079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5037}
5038
5039void
5040melt_ice(coordxy x, coordxy y, const char *msg)
5041{
5042 struct rm *lev = &levl[x][y];
5043 struct obj *otmp;
5044 struct monst *mtmp;
5045
5046 if (!msg)
5047 msg = "The ice crackles and melts.";
5048 if (lev->typ == DRAWBRIDGE_UP || lev->typ == DRAWBRIDGE_DOWN) {
5049 lev->drawbridgemask &= ~DB_ICE; /* revert to DB_MOAT */
5050 } else { /* lev->typ == ICE */
5051 lev->typ = (lev->icedpool == ICED_POOL ? POOL : MOAT);
5052 lev->icedpool = 0;
5053 }
5054 spot_stop_timers(x, y, MELT_ICE_AWAY); /* no more ice to melt away */
5055 if (t_at(x, y))
5056 trap_ice_effects(x, y, TRUE); /* TRUE because ice_is_melting */
5057 obj_ice_effects(x, y, FALSE);
5058 unearth_objs(x, y);
5059 if (Underwater)
5060 vision_recalc(1);
5061 newsym(x, y);
5062 if (cansee(x, y) || u_at(x, y))
5063 Norep("%s", msg);
5064 if ((otmp = sobj_at(BOULDER, x, y)) != 0) {
5065 if (cansee(x, y))
5066 pline("%s settles...", An(xname(otmp)));
5067 do {
5068 obj_extract_self(otmp); /* boulder isn't being pushed */
5069 if (!boulder_hits_pool(otmp, x, y, FALSE))
5070 impossible("melt_ice: no pool?");
5071 /* try again if there's another boulder and pool didn't fill */
5072 } while (is_pool(x, y) && (otmp = sobj_at(BOULDER, x, y)) != 0);
5073 newsym(x, y);
5074 }
5075 if (u_at(x, y))
5076 spoteffects(TRUE); /* possibly drown, notice objects */
5077 else if (is_pool(x, y) && (mtmp = m_at(x, y)) != 0)
5078 (void) minliquid(mtmp);
5079}
5080
5081#define MIN_ICE_TIME 50
5082#define MAX_ICE_TIME 2000

Callers 5

vomitFunction · 0.85
trapeffect_fire_trapFunction · 0.85
dofiretrapFunction · 0.85
melt_ice_awayFunction · 0.85
zap_over_floorFunction · 0.85

Calls 15

spot_stop_timersFunction · 0.85
t_atFunction · 0.85
trap_ice_effectsFunction · 0.85
obj_ice_effectsFunction · 0.85
unearth_objsFunction · 0.85
vision_recalcFunction · 0.85
newsymFunction · 0.85
NorepFunction · 0.85
sobj_atFunction · 0.85
AnFunction · 0.85
xnameFunction · 0.85
obj_extract_selfFunction · 0.85

Tested by

no test coverage detected