MCPcopy Index your code
hub / github.com/NetHack/NetHack / stop_timer

Function stop_timer

src/timeout.c:2298–2318  ·  view source on GitHub ↗

* Remove the timer from the current list and free it up. Return the time * remaining until it would have gone off, 0 if not found. */

Source from the content-addressed store, hash-verified

2296 * remaining until it would have gone off, 0 if not found.
2297 */
2298long
2299stop_timer(short func_index, anything *arg)
2300{
2301 timeout_proc cleanup_func;
2302 timer_element *doomed;
2303 long timeout;
2304
2305 doomed = remove_timer(&gt.timer_base, func_index, arg);
2306
2307 if (doomed) {
2308 timeout = doomed->timeout;
2309 if (doomed->kind == TIMER_OBJECT)
2310 (arg->a_obj)->timed--;
2311 if ((cleanup_func = timeout_funcs[doomed->func_index].cleanup) != 0)
2312 (*cleanup_func)(arg, timeout);
2313 (void) memset((genericptr_t) doomed, 0, sizeof(timer_element));
2314 free((genericptr_t) doomed);
2315 return (timeout - svm.moves);
2316 }
2317 return 0L;
2318}
2319
2320/*
2321 * Find the timeout of specified timer; return 0 if none.

Callers 15

l_obj_timer_stopFunction · 0.85
l_obj_timer_startFunction · 0.85
disturb_buried_zombiesFunction · 0.85
attach_egg_hatch_timeoutFunction · 0.85
kill_eggFunction · 0.85
end_burnFunction · 0.85
buried_ball_to_freedomFunction · 0.85
unearth_objsFunction · 0.85
freeinv_coreFunction · 0.85
in_containerFunction · 0.85

Calls 1

remove_timerFunction · 0.85

Tested by

no test coverage detected