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

Function save_stairs

src/save.c:664–691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662}
663
664staticfn void
665save_stairs(NHFILE *nhfp)
666{
667 stairway *stway = gs.stairs;
668 int buflen = (int) sizeof *stway;
669
670 while (stway) {
671 if (update_file(nhfp)) {
672 boolean use_relative = (program_state.restoring != REST_GSTATE
673 && stway->tolev.dnum == u.uz.dnum);
674 if (use_relative) {
675 /* make dlevel relative to current level */
676 stway->tolev.dlevel -= u.uz.dlevel;
677 }
678 Sfo_int(nhfp, &buflen, "stairs-staircount");
679 Sfo_stairway(nhfp, stway, "stairs-stairway");
680 if (use_relative) {
681 /* reset stairway dlevel back to absolute */
682 stway->tolev.dlevel += u.uz.dlevel;
683 }
684 }
685 stway = stway->next;
686 }
687 if (update_file(nhfp)) {
688 buflen = -1;
689 Sfo_int(nhfp, &buflen, "stairs-staircount");
690 }
691}
692
693/* if ball and/or chain are loose, make an object chain for it/them and
694 save that separately from other objects */

Callers 1

savelev_coreFunction · 0.85

Calls 1

update_fileFunction · 0.85

Tested by

no test coverage detected