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

Function restore_timers

src/timeout.c:2706–2728  ·  view source on GitHub ↗

* Pull in the structures from disk, but don't recalculate the object and * monster pointers. */

Source from the content-addressed store, hash-verified

2704 * monster pointers.
2705 */
2706void
2707restore_timers(NHFILE *nhfp, int range, long adjust)
2708{
2709 int count = 0;
2710 timer_element *curr;
2711 boolean ghostly = (nhfp->ftype == NHF_BONESFILE); /* from a ghost level */
2712
2713 if (range == RANGE_GLOBAL) {
2714 Sfi_ulong(nhfp, &svt.timer_id, "timer-timer_id");
2715 }
2716
2717 /* restore elements */
2718 Sfi_int(nhfp, &count, "timer-timer_count");
2719 while (count-- > 0) {
2720 curr = (timer_element *) alloc(sizeof(timer_element));
2721 Sfi_fe(nhfp, curr, "timer");
2722 if (ghostly)
2723 curr->timeout += adjust;
2724#ifndef SFCTOOL
2725 insert_timer(curr);
2726#endif
2727 }
2728}
2729
2730#ifndef SFCTOOL
2731DISABLE_WARNING_FORMAT_NONLITERAL

Callers 2

restgamestateFunction · 0.85
getlevFunction · 0.85

Calls 2

insert_timerFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected