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

Function restlevelfile

src/restore.c:754–771  ·  view source on GitHub ↗

after getlev(), put current level into a level/lock file; essential when splitting a save file into individual level files */ ARGSUSED*/

Source from the content-addressed store, hash-verified

752 essential when splitting a save file into individual level files */
753/*ARGSUSED*/
754staticfn int
755restlevelfile(xint8 ltmp)
756{
757 char whynot[BUFSZ];
758 NHFILE *nhfp = (NHFILE *) 0;
759
760 nhfp = create_levelfile(ltmp, whynot);
761 if (!nhfp) {
762 /* failed to create a new file; don't attempt to make a panic save */
763 program_state.something_worth_saving = 0;
764 panic("restlevelfile: %s", whynot);
765 }
766 bufon(nhfp->fd);
767 nhfp->mode = WRITING | FREEING;
768 savelev(nhfp, ltmp);
769 close_nhfile(nhfp);
770 return 2;
771}
772
773/*
774 * restore_saved_game() prior to this left us at this position in

Callers 1

dorecoverFunction · 0.85

Calls 5

create_levelfileFunction · 0.85
bufonFunction · 0.85
savelevFunction · 0.85
close_nhfileFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected