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

Function restore_saved_game

src/files.c:1269–1287  ·  view source on GitHub ↗

try to open up a save file and prepare to restore it */

Source from the content-addressed store, hash-verified

1267
1268/* try to open up a save file and prepare to restore it */
1269NHFILE *
1270restore_saved_game(void)
1271{
1272 const char *fq_save;
1273 NHFILE *nhfp = (NHFILE *) 0;
1274 int sfstatus = 0;
1275
1276 set_savefile_name(TRUE);
1277 fq_save = fqname(gs.SAVEF, SAVEPREFIX, 0);
1278
1279 nh_uncompress(fq_save);
1280 if ((nhfp = open_savefile()) != 0) {
1281 if ((sfstatus = validate(nhfp, fq_save, FALSE)) != SF_UPTODATE) {
1282 close_nhfile(nhfp);
1283 nhfp = problematic_savefile(sfstatus, fq_save);
1284 }
1285 }
1286 return nhfp;
1287}
1288
1289/*
1290 * This doesn't open any files. It provides a valid (NHFILE *)

Callers 7

mainFunction · 0.85
libnhmain.cFile · 0.85
MAINFunction · 0.85
mainFunction · 0.85
pcmainFunction · 0.85
MAINFunction · 0.85
mainFunction · 0.85

Calls 7

set_savefile_nameFunction · 0.85
fqnameFunction · 0.85
nh_uncompressFunction · 0.85
open_savefileFunction · 0.85
validateFunction · 0.85
close_nhfileFunction · 0.85
problematic_savefileFunction · 0.85

Tested by

no test coverage detected