try to prevent panic encountering empty bones file
This commit is contained in:
@@ -659,16 +659,19 @@ getbones(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
restoreinfo.mread_flags = 1; /* return despite error for a bones file */
|
||||
if (validate(nhfp, gb.bones, FALSE) != SF_UPTODATE) {
|
||||
if (!wizard)
|
||||
pline("Discarding unusable bones; no need to panic...");
|
||||
ok = FALSE;
|
||||
restoreinfo.mread_flags = 0;
|
||||
} else {
|
||||
ok = TRUE;
|
||||
if (wizard) {
|
||||
if (y_n("Get bones?") == 'n') {
|
||||
close_nhfile(nhfp);
|
||||
compress_bonesfile();
|
||||
restoreinfo.mread_flags = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -684,6 +687,7 @@ getbones(void)
|
||||
close_nhfile(nhfp);
|
||||
compress_bonesfile();
|
||||
/* ToDo: maybe unlink these problematic bones? */
|
||||
restoreinfo.mread_flags = 0;
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(bonesid, oldbonesid) != 0) {
|
||||
@@ -695,6 +699,7 @@ getbones(void)
|
||||
pline1(errbuf);
|
||||
ok = FALSE; /* won't die of trickery */
|
||||
}
|
||||
restoreinfo.mread_flags = 0;
|
||||
trickery(errbuf);
|
||||
} else {
|
||||
struct monst *mtmp;
|
||||
@@ -726,6 +731,7 @@ getbones(void)
|
||||
fix_shop_damage();
|
||||
}
|
||||
}
|
||||
restoreinfo.mread_flags = 0;
|
||||
close_nhfile(nhfp);
|
||||
sanitize_engravings();
|
||||
u.uroleplay.numbones++;
|
||||
|
||||
Reference in New Issue
Block a user