melting ice (trunk only)

add a new melt_ice_away timer for ice created via zapping
a wand/spell of cold.

Some follow-up adjustments to the length of time before
the ice melts may be necessary. Ideally, I'd like to
have it so that the shorter the length of time since
the ice was created, the lesser the chance that it will
melt out from under you.  Likewise, the longer it has
been, the more risky it will be to venture onto it.

At the moment, however, each spot of ice is just
getting a somewhat random time always greater
than 50, which is less than ideal.
This commit is contained in:
nethack.allison
2003-10-12 04:21:27 +00:00
parent f6425ee3c5
commit 6712fc1b04
6 changed files with 80 additions and 8 deletions

View File

@@ -1309,7 +1309,8 @@ static const ttable timeout_funcs[NUM_TIME_FUNCS] = {
TTAB(revive_mon, (timeout_proc)0, "revive_mon"),
TTAB(burn_object, cleanup_burn, "burn_object"),
TTAB(hatch_egg, (timeout_proc)0, "hatch_egg"),
TTAB(fig_transform, (timeout_proc)0, "fig_transform")
TTAB(fig_transform, (timeout_proc)0, "fig_transform"),
TTAB(melt_ice_away, (timeout_proc)0, "melt_ice_away")
};
#undef TTAB
@@ -1554,6 +1555,36 @@ obj_stop_timers(obj)
obj->timed = 0;
}
/*
* Stop all timers of index func_index at this spot.
*
*/
void
spot_stop_timers(x,y,func_index)
xchar x,y;
short func_index;
{
timer_element *curr, *prev, *next_timer=0;
long where = (((long)x << 16) | ((long)y));
for (prev = 0, curr = timer_base; curr; curr = next_timer) {
next_timer = curr->next;
if (curr->kind == TIMER_LEVEL &&
curr->func_index == func_index && curr->arg == (genericptr_t)where) {
if (prev)
prev->next = curr->next;
else
timer_base = curr->next;
if (timeout_funcs[curr->func_index].cleanup)
(*timeout_funcs[curr->func_index].cleanup)(curr->arg,
curr->timeout);
free((genericptr_t) curr);
} else {
prev = curr;
}
}
}
/* Insert timer into the global queue */
STATIC_OVL void