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

Function rest_worm

src/worm.c:576–603  ·  view source on GitHub ↗

* rest_worm() * * Restore the worm information from the save file. Called from restore.c */

Source from the content-addressed store, hash-verified

574 * Restore the worm information from the save file. Called from restore.c
575 */
576void
577rest_worm(NHFILE *nhfp)
578{
579 int i, j;
580 int count = 0;
581 struct wseg *curr, *temp;
582
583 for (i = 1; i < MAX_NUM_WORMS; i++) {
584 Sfi_int(nhfp, &count, "worm-segment_count");
585
586 /* Get the segments. */
587 for (curr = (struct wseg *) 0, j = 0; j < count; j++) {
588 temp = newseg();
589 temp->nseg = (struct wseg *) 0;
590 Sfi_coordxy(nhfp, &(temp->wx), "worm-wx");
591 Sfi_coordxy(nhfp, &(temp->wy), "worm-wy");
592 if (curr)
593 curr->nseg = temp;
594 else
595 wtails[i] = temp;
596 curr = temp;
597 }
598 wheads[i] = curr;
599 }
600 for (i = 0; i < MAX_NUM_WORMS; ++i) {
601 Sfi_long(nhfp, &wgrowtime[i], "worm-wgrowtime");
602 }
603}
604
605#ifndef SFCTOOL
606/*

Callers 1

getlevFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected