From 2a912fe001fb8cee03d615906b20ecf8c56f6c1f Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 30 May 2026 11:32:37 -0400 Subject: [PATCH] SELECTSAVE update In SELECTSAVE implementations, out of date savefiles in the tree were triggering error messages to the user during the building of the pick list. The file with the error never ended up on the pick list, or got removed, so the error was perpetual on every SELECTSAVE startup. This passes the UTD_QUIETLY flag down the the small set of callers involved, so that when it was received by uptodate(), it went about its verification work quietly. --- include/extern.h | 4 ++-- src/bones.c | 2 +- src/files.c | 17 +++++++++++------ src/restore.c | 2 +- src/version.c | 5 ++++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/extern.h b/include/extern.h index 90af830f4..6dd14db52 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1102,7 +1102,7 @@ extern NHFILE *get_freeing_nhfile(void); extern NHFILE *restore_saved_game(void); extern int check_panic_save(void); #ifdef SELECTSAVED -extern char *plname_from_file(const char *, boolean) NONNULLARG1; +extern char *plname_from_file(const char *, boolean, int) NONNULLARG1; #endif extern char **get_saved_games(void); extern void free_saved_games(char **); @@ -3602,7 +3602,7 @@ extern void dump_version_info(void); extern void store_critical_bytes(NHFILE *) NONNULLARG1; extern int compare_critical_bytes(NHFILE *, int *, unsigned long) NONNULLARG1; extern int get_critical_size_count(void); -extern int validate(NHFILE *, const char *, boolean) NONNULLARG1; +extern int validate(NHFILE *, const char *, boolean, int) NONNULLARG1; /* ### video.c ### */ diff --git a/src/bones.c b/src/bones.c index 092ed203a..e55857d4b 100644 --- a/src/bones.c +++ b/src/bones.c @@ -661,7 +661,7 @@ getbones(void) } program_state.reading_bonesfile = 1; - if (validate(nhfp, gb.bones, FALSE) != SF_UPTODATE) { + if (validate(nhfp, gb.bones, FALSE, 0) != SF_UPTODATE) { if (!wizard) pline("Discarding unusable bones; no need to panic..."); ok = FALSE; diff --git a/src/files.c b/src/files.c index 16c0f32c8..bb6e7c5a8 100644 --- a/src/files.c +++ b/src/files.c @@ -1269,7 +1269,7 @@ restore_saved_game(void) nh_uncompress(fq_save); if ((nhfp = open_savefile()) != 0) { - if ((sfstatus = validate(nhfp, fq_save, FALSE)) != SF_UPTODATE) { + if ((sfstatus = validate(nhfp, fq_save, FALSE, 0)) != SF_UPTODATE) { close_nhfile(nhfp); nhfp = problematic_savefile(sfstatus, fq_save); } @@ -1347,7 +1347,7 @@ check_panic_save(void) char * plname_from_file( const char *filename, - boolean without_wait_synch_per_file) + boolean without_wait_synch_per_file, int additional_utd_flags) { NHFILE *nhfp; unsigned ln; @@ -1368,7 +1368,8 @@ plname_from_file( nh_uncompress(gs.SAVEF); if ((nhfp = open_savefile()) != 0) { if ((sfstatus = validate(nhfp, filename, - without_wait_synch_per_file)) == SF_UPTODATE) { + without_wait_synch_per_file, + additional_utd_flags)) == SF_UPTODATE) { /* room for "name+role+race+gend+algn X" where the space before X is actually NUL and X is playmode: one of '-', 'X', or 'D' */ ln = (unsigned) PL_NSIZ_PLUS; @@ -1405,7 +1406,7 @@ get_saved_games(void) const char *fq_old_save; #endif char **files = 0; - int i, count_failures = 0; + int i, count_failures = 0, utd_flags_to_pass_downstream = 0; Strcpy(svp.plname, "*"); set_savefile_name(FALSE); @@ -1438,7 +1439,11 @@ get_saved_games(void) (void) memset((genericptr_t) result, 0, (n + 1) * sizeof (char *)); for(i = 0; i < n; i++) { char *r; - r = plname_from_file(files[i], SUPPRESS_WAITSYNCH_PERFILE); + if (!wizard) + utd_flags_to_pass_downstream = UTD_QUIETLY; + r = plname_from_file(files[i], + SUPPRESS_WAITSYNCH_PERFILE, + utd_flags_to_pass_downstream); if (r) { /* this renaming of the savefile is not compatible @@ -1465,7 +1470,7 @@ get_saved_games(void) } free_saved_games(files); - if (count_failures) + if (count_failures && !(utd_flags_to_pass_downstream & UTD_QUIETLY)) wait_synch(); } #endif /* WIN32 */ diff --git a/src/restore.c b/src/restore.c index 870c678f5..318f90e53 100644 --- a/src/restore.c +++ b/src/restore.c @@ -890,7 +890,7 @@ dorecover(NHFILE *nhfp) restoreinfo.mread_flags = 0; rewind_nhfile(nhfp); /* return to beginning of file */ - (void) validate(nhfp, (char *) 0, FALSE); + (void) validate(nhfp, (char *) 0, FALSE, 0); get_plname_from_file(nhfp, svp.plname, TRUE); /* not 0 nor REST_GSTATE nor REST_LEVELS */ diff --git a/src/version.c b/src/version.c index 117d7bdf0..8fa0e0398 100644 --- a/src/version.c +++ b/src/version.c @@ -849,11 +849,14 @@ compare_critical_bytes(NHFILE *nhfp, int *idx_1st_mismatch, unsigned long utdfla * SF_DM_MISMATCH (9) some other mismatch */ int -validate(NHFILE *nhfp, const char *name, boolean without_waitsynch_perfile) +validate(NHFILE *nhfp, const char *name, boolean without_waitsynch_perfile, + int additional_utd_flags) { unsigned long utdflags = 0L; int validsf = 0; +if (additional_utd_flags) + utdflags |= additional_utd_flags; #ifdef SFCTOOL utdflags |= UTD_QUIETLY; #endif