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

Function start_melt_ice_timeout

src/zap.c:5087–5111  ·  view source on GitHub ↗

* Usually start a melt_ice timer; sometimes the ice will become * permanent instead. */

Source from the content-addressed store, hash-verified

5085 * permanent instead.
5086 */
5087void
5088start_melt_ice_timeout(
5089 coordxy x, coordxy y,
5090 long min_time) /* <x,y>'s old melt timeout (deleted by time we get here) */
5091{
5092 int when;
5093 long where;
5094
5095 when = (int) min_time;
5096 if (when < MIN_ICE_TIME - 1)
5097 when = MIN_ICE_TIME - 1;
5098
5099 /* random timeout; surrounding ice locations ought to be a factor... */
5100 while (++when <= MAX_ICE_TIME)
5101 if (!rn2((MAX_ICE_TIME - when) + MIN_ICE_TIME))
5102 break;
5103
5104 /* if we're within MAX_ICE_TIME, install a melt timer;
5105 otherwise, omit it to leave this ice permanent */
5106 if (when <= MAX_ICE_TIME) {
5107 where = ((long) x << 16) | (long) y;
5108 (void) start_timer((long) when, TIMER_LEVEL, MELT_ICE_AWAY,
5109 long_to_any(where));
5110 }
5111}
5112#undef MIN_ICE_TIME
5113#undef MAX_ICE_TIME
5114

Callers 2

wizterrainwishFunction · 0.85
zap_over_floorFunction · 0.85

Calls 3

rn2Function · 0.85
start_timerFunction · 0.85
long_to_anyFunction · 0.85

Tested by

no test coverage detected