From c5b258c2cf9237500f418ef867e27330429dcd2b Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 30 Apr 2026 09:08:29 -0400 Subject: [PATCH] more empty bonesfile --- include/hack.h | 1 + src/bones.c | 12 ++++++------ src/sfstruct.c | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/hack.h b/include/hack.h index 19f543ac0..b59a712b1 100644 --- a/include/hack.h +++ b/include/hack.h @@ -798,6 +798,7 @@ struct sinfo { int config_error_ready; /* config_error_add is ready, available */ int beyond_savefile_load; /* set when past savefile loading */ int savefile_completed; /* savefile has completed writing */ + int reading_bonesfile; /* in the midst of trying to read bones file */ #ifdef PANICLOG int in_paniclog; /* writing a panicloc entry */ #endif diff --git a/src/bones.c b/src/bones.c index 3e484279f..85431390f 100644 --- a/src/bones.c +++ b/src/bones.c @@ -659,19 +659,19 @@ getbones(void) 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 (!wizard) pline("Discarding unusable bones; no need to panic..."); ok = FALSE; - restoreinfo.mread_flags = 0; + program_state.reading_bonesfile = 0; } else { ok = TRUE; if (wizard) { if (y_n("Get bones?") == 'n') { close_nhfile(nhfp); compress_bonesfile(); - restoreinfo.mread_flags = 0; + program_state.reading_bonesfile = 0; return 0; } } @@ -687,7 +687,7 @@ getbones(void) close_nhfile(nhfp); compress_bonesfile(); /* ToDo: maybe unlink these problematic bones? */ - restoreinfo.mread_flags = 0; + program_state.reading_bonesfile = 0; return 0; } if (strcmp(bonesid, oldbonesid) != 0) { @@ -699,7 +699,7 @@ getbones(void) pline1(errbuf); ok = FALSE; /* won't die of trickery */ } - restoreinfo.mread_flags = 0; + program_state.reading_bonesfile = 0; trickery(errbuf); } else { struct monst *mtmp; @@ -731,8 +731,8 @@ getbones(void) fix_shop_damage(); } } - restoreinfo.mread_flags = 0; close_nhfile(nhfp); + program_state.reading_bonesfile = 0; sanitize_engravings(); u.uroleplay.numbones++; diff --git a/src/sfstruct.c b/src/sfstruct.c index 8a15a0c17..5e793079b 100644 --- a/src/sfstruct.c +++ b/src/sfstruct.c @@ -572,7 +572,8 @@ mread(int fd, genericptr_t buf, unsigned len) /* Not perfect, but we don't have ssize_t available. */ rlen = (readLenType) read(fd, buf, (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; return; } else {