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

Function spot_stop_timers

src/timeout.c:2415–2438  ·  view source on GitHub ↗

* Stop all timers of index func_index at this spot. * */

Source from the content-addressed store, hash-verified

2413 *
2414 */
2415void
2416spot_stop_timers(coordxy x, coordxy y, short func_index)
2417{
2418 timeout_proc cleanup_func;
2419 timer_element *curr, *prev, *next_timer = 0;
2420 long where = (((long) x << 16) | ((long) y));
2421
2422 for (prev = 0, curr = gt.timer_base; curr; curr = next_timer) {
2423 next_timer = curr->next;
2424 if (curr->kind == TIMER_LEVEL && curr->func_index == func_index
2425 && curr->arg.a_long == where) {
2426 if (prev)
2427 prev->next = curr->next;
2428 else
2429 gt.timer_base = curr->next;
2430 if ((cleanup_func = timeout_funcs[curr->func_index].cleanup) != 0)
2431 (*cleanup_func)(&curr->arg, curr->timeout);
2432 (void) memset((genericptr_t) curr, 0, sizeof(timer_element));
2433 free((genericptr_t) curr);
2434 } else {
2435 prev = curr;
2436 }
2437 }
2438}
2439
2440/*
2441 * When is the spot timer of type func_index going to expire?

Callers 10

wizterrainwishFunction · 0.85
nhl_timer_stop_atFunction · 0.85
nhl_timer_start_atFunction · 0.85
spot_checksFunction · 0.85
invaultFunction · 0.85
maketrapFunction · 0.85
melt_iceFunction · 0.85
zap_over_floorFunction · 0.85
do_break_wandFunction · 0.85
set_levltypFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected