more empty bonesfile

This commit is contained in:
nhmall
2026-04-30 09:08:29 -04:00
parent 7fdaf92367
commit c5b258c2cf
3 changed files with 9 additions and 7 deletions
+1
View File
@@ -798,6 +798,7 @@ struct sinfo {
int config_error_ready; /* config_error_add is ready, available */ int config_error_ready; /* config_error_add is ready, available */
int beyond_savefile_load; /* set when past savefile loading */ int beyond_savefile_load; /* set when past savefile loading */
int savefile_completed; /* savefile has completed writing */ int savefile_completed; /* savefile has completed writing */
int reading_bonesfile; /* in the midst of trying to read bones file */
#ifdef PANICLOG #ifdef PANICLOG
int in_paniclog; /* writing a panicloc entry */ int in_paniclog; /* writing a panicloc entry */
#endif #endif
+6 -6
View File
@@ -659,19 +659,19 @@ getbones(void)
return 0; return 0;
} }
restoreinfo.mread_flags = 1; /* return despite error for a bones file */ program_state.reading_bonesfile = 1;
if (validate(nhfp, gb.bones, FALSE) != SF_UPTODATE) { if (validate(nhfp, gb.bones, FALSE) != SF_UPTODATE) {
if (!wizard) if (!wizard)
pline("Discarding unusable bones; no need to panic..."); pline("Discarding unusable bones; no need to panic...");
ok = FALSE; ok = FALSE;
restoreinfo.mread_flags = 0; program_state.reading_bonesfile = 0;
} else { } else {
ok = TRUE; ok = TRUE;
if (wizard) { if (wizard) {
if (y_n("Get bones?") == 'n') { if (y_n("Get bones?") == 'n') {
close_nhfile(nhfp); close_nhfile(nhfp);
compress_bonesfile(); compress_bonesfile();
restoreinfo.mread_flags = 0; program_state.reading_bonesfile = 0;
return 0; return 0;
} }
} }
@@ -687,7 +687,7 @@ getbones(void)
close_nhfile(nhfp); close_nhfile(nhfp);
compress_bonesfile(); compress_bonesfile();
/* ToDo: maybe unlink these problematic bones? */ /* ToDo: maybe unlink these problematic bones? */
restoreinfo.mread_flags = 0; program_state.reading_bonesfile = 0;
return 0; return 0;
} }
if (strcmp(bonesid, oldbonesid) != 0) { if (strcmp(bonesid, oldbonesid) != 0) {
@@ -699,7 +699,7 @@ getbones(void)
pline1(errbuf); pline1(errbuf);
ok = FALSE; /* won't die of trickery */ ok = FALSE; /* won't die of trickery */
} }
restoreinfo.mread_flags = 0; program_state.reading_bonesfile = 0;
trickery(errbuf); trickery(errbuf);
} else { } else {
struct monst *mtmp; struct monst *mtmp;
@@ -731,8 +731,8 @@ getbones(void)
fix_shop_damage(); fix_shop_damage();
} }
} }
restoreinfo.mread_flags = 0;
close_nhfile(nhfp); close_nhfile(nhfp);
program_state.reading_bonesfile = 0;
sanitize_engravings(); sanitize_engravings();
u.uroleplay.numbones++; u.uroleplay.numbones++;
+2 -1
View File
@@ -572,7 +572,8 @@ mread(int fd, genericptr_t buf, unsigned len)
/* Not perfect, but we don't have ssize_t available. */ /* Not perfect, but we don't have ssize_t available. */
rlen = (readLenType) read(fd, buf, (readLenType) len); rlen = (readLenType) read(fd, buf, (readLenType) len);
if ((readLenType) rlen != (readLenType) len) { if ((readLenType) rlen != (readLenType) len) {
if (restoreinfo.mread_flags == 1) { /* means "return anyway" */ if ((restoreinfo.mread_flags == 1) /* means "return anyway" */
|| (program_state.reading_bonesfile == 1)) {
restoreinfo.mread_flags = -1; restoreinfo.mread_flags = -1;
return; return;
} else { } else {