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.
This commit is contained in:
+2
-2
@@ -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 ### */
|
||||
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+11
-6
@@ -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 */
|
||||
|
||||
+1
-1
@@ -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 */
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user