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

Function obj_split_timers

src/timeout.c:2358–2370  ·  view source on GitHub ↗

* Find all object timers and duplicate them for the new object "dest". */

Source from the content-addressed store, hash-verified

2356 * Find all object timers and duplicate them for the new object "dest".
2357 */
2358void
2359obj_split_timers(struct obj *src, struct obj *dest)
2360{
2361 timer_element *curr, *next_timer = 0;
2362
2363 for (curr = gt.timer_base; curr; curr = next_timer) {
2364 next_timer = curr->next; /* things may be inserted */
2365 if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
2366 (void) start_timer(curr->timeout - svm.moves, TIMER_OBJECT,
2367 curr->func_index, obj_to_any(dest));
2368 }
2369 }
2370}
2371
2372/*
2373 * Stop all timers attached to this object. We can get away with this because

Callers 1

splitobjFunction · 0.85

Calls 2

start_timerFunction · 0.85
obj_to_anyFunction · 0.85

Tested by

no test coverage detected