improve selectsave handling for Windows

If there were outdated savefiles encountered during
startup, each individual one was getting a wait_synch
that required a <return> even though a message window
wasn't being used at that point.

Allow suppression of the individual per-file wait_synch()
calls on Windows, so that a single one can be done once
the selectsave processing is overwith.

This was a little messy because an indicator had to flow
down through validate(), uptodate(), etc.

There shouldn't be any change in how things behave on
any non-Windows platforms.
This commit is contained in:
nhmall
2023-09-22 15:14:53 -04:00
parent c868feb383
commit 14faa682c4
11 changed files with 41 additions and 61 deletions

View File

@@ -34,44 +34,6 @@ static struct stat hbuf;
static int eraseoldlocks(void);
#endif
#if 0
int
uptodate(int fd)
{
#ifdef WANT_GETHDATE
if(fstat(fd, &buf)) {
pline("Cannot get status of saved level? ");
return(0);
}
if(buf.st_mtime < hbuf.st_mtime) {
pline("Saved level is out of date. ");
return(0);
}
#else
#if (defined(MICRO)) && !defined(NO_FSTAT)
if(fstat(fd, &buf)) {
if(gm.moves > 1) pline("Cannot get status of saved level? ");
else pline("Cannot get status of saved game.");
return(0);
}
if(comp_times(buf.st_mtime)) {
if(gm.moves > 1) pline("Saved level is out of date.");
else pline("Saved game is out of date. ");
/* This problem occurs enough times we need to give the player
* some more information about what causes it, and how to fix.
*/
#ifdef MSDOS
pline("Make sure that your system's date and time are correct.");
pline("They must be more current than NetHack.EXE's date/time stamp.");
#endif /* MSDOS */
return(0);
}
#endif /* MICRO */
#endif /* WANT_GETHDATE */
return(1);
}
#endif
#if defined(PC_LOCKING)
#if !defined(SELF_RECOVER)
static int

View File

@@ -629,7 +629,7 @@ vms_get_saved_games(const char *savetemplate, /* wildcarded save file name in na
if (filename[l - 1] != ' ')
break;
filename[l] = '\0';
if ((charname = plname_from_file(filename)) != 0)
if ((charname = plname_from_file(filename, FALSE)) != 0)
savefile(charname, count++, &asize, outarray);
}
(void) lib$find_file_end(&context);

View File

@@ -39,7 +39,7 @@
#endif
#endif
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
extern boolean getreturn_enabled; /* from windmain.c */
extern int redirect_stdout;
#ifdef TTY_GRAPHICS

View File

@@ -552,8 +552,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
chdir(gf.fqn_prefix[HACKPREFIX]);
#endif
if (GUILaunched || IsDebuggerPresent())
getreturn_enabled = TRUE;
/* if (GUILaunched || IsDebuggerPresent()) */
getreturn_enabled = TRUE;
check_recordfile((char *) 0);
iflags.windowtype_deferred = TRUE;

View File

@@ -491,7 +491,7 @@ nethack_exit(int code)
/* use our custom version which works
a little cleaner than the stdio one */
windowprocs.win_nhgetch = windows_console_custom_nhgetch;
}
} else
#endif
if (getreturn_enabled) {
raw_print("\n");
@@ -525,7 +525,8 @@ getreturn(const char *str)
raw_print(buf);
if (WINDOWPORT(tty))
windows_console_custom_nhgetch();
wait_synch();
else
wait_synch();
in_getreturn = FALSE;
return;
}