Merge branch 'master' into NetHack-3.7
# Conflicts: # src/pline.c # sys/winnt/windmain.c # win/tty/topl.c # win/win32/scripts/fuzzer/longtest.bat # win/win32/scripts/fuzzer/restore.bat # win/win32/scripts/fuzzer/runtill.bat
This commit is contained in:
@@ -398,12 +398,10 @@ int mode; // unused
|
||||
{
|
||||
DWORD cmode;
|
||||
|
||||
#ifndef NEW_KEYBOARD_HIT
|
||||
/* Initialize the function pointer that points to
|
||||
* the kbhit() equivalent, in this TTY case nttty_kbhit()
|
||||
*/
|
||||
nt_kbhit = nttty_kbhit;
|
||||
#endif
|
||||
|
||||
if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) {
|
||||
/* Unable to set control handler */
|
||||
@@ -438,19 +436,11 @@ int portdebug;
|
||||
return ch;
|
||||
}
|
||||
|
||||
#ifndef NEW_KEYBOARD_HIT
|
||||
int
|
||||
nttty_kbhit()
|
||||
{
|
||||
return keyboard_handler.pNHkbhit(console.hConIn, &ir);
|
||||
}
|
||||
#else
|
||||
boolean
|
||||
tkbhit()
|
||||
{
|
||||
return keyboard_handler.pNHkbhit(console.hConIn, &ir) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
tgetch()
|
||||
|
||||
@@ -337,7 +337,7 @@ attempt_restore:
|
||||
resuming = TRUE; /* not starting new game */
|
||||
if (discover)
|
||||
You("are in non-scoring discovery mode.");
|
||||
if ((discover || wizard) && !iflags.fuzzer_auto_start) {
|
||||
if (discover || wizard) {
|
||||
if (yn("Do you want to keep the save file?") == 'n')
|
||||
(void) delete_savefile();
|
||||
else {
|
||||
@@ -462,28 +462,6 @@ char *argv[];
|
||||
case 'X':
|
||||
discover = TRUE, wizard = FALSE;
|
||||
break;
|
||||
case 'F':
|
||||
{
|
||||
iflags.fuzzer_auto_start = 1;
|
||||
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
argc--;
|
||||
argv++;
|
||||
iflags.fuzzer_stop_and_save = atoi(*argv);
|
||||
|
||||
/* turn off getreturn_enabled so that game does not
|
||||
* prompt for input when exiting
|
||||
*/
|
||||
getreturn_enabled = FALSE;
|
||||
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
argc--;
|
||||
argv++;
|
||||
iflags.verbose_logging_start = atoi(*argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef NEWS
|
||||
case 'n':
|
||||
iflags.news = FALSE;
|
||||
|
||||
@@ -56,7 +56,6 @@ extern void NDECL(backsp);
|
||||
int NDECL(windows_console_custom_nhgetch);
|
||||
extern void NDECL(safe_routines);
|
||||
|
||||
#ifndef NEW_KEYBOARD_HIT
|
||||
/* The function pointer nt_kbhit contains a kbhit() equivalent
|
||||
* which varies depending on which window port is active.
|
||||
* For the tty port it is tty_kbhit() [from nttty.c]
|
||||
@@ -66,7 +65,6 @@ extern void NDECL(safe_routines);
|
||||
|
||||
int def_kbhit(void);
|
||||
int (*nt_kbhit)() = def_kbhit;
|
||||
#endif
|
||||
|
||||
char
|
||||
switchar()
|
||||
@@ -160,13 +158,11 @@ max_filename()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef NEW_KEYBOARD_HIT
|
||||
int
|
||||
def_kbhit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Strip out troublesome file system characters.
|
||||
@@ -475,6 +471,23 @@ char *buf;
|
||||
}
|
||||
#endif /* RUNTIME_PORT_ID */
|
||||
|
||||
/* nhassert_failed is called when an nhassert's condition is false */
|
||||
void nhassert_failed(const char * exp, const char * file, int line)
|
||||
{
|
||||
char message[128];
|
||||
_snprintf(message, sizeof(message),
|
||||
"NHASSERT(%s) in '%s' at line %d\n", exp, file, line);
|
||||
|
||||
if (IsDebuggerPresent()) {
|
||||
OutputDebugStringA(message);
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
// strip off the newline
|
||||
message[strlen(message) - 1] = '\0';
|
||||
error(message);
|
||||
}
|
||||
|
||||
void
|
||||
nethack_exit(code)
|
||||
int code;
|
||||
@@ -499,9 +512,7 @@ int code;
|
||||
exit(code);
|
||||
}
|
||||
|
||||
#ifndef NEW_KEYBOARD_HIT
|
||||
#undef kbhit
|
||||
#endif
|
||||
#include <conio.h>
|
||||
|
||||
int
|
||||
@@ -711,32 +722,6 @@ sys_random_seed(VOID_ARGS)
|
||||
return ourseed;
|
||||
}
|
||||
|
||||
/* nt_assert_failed is called when an nhassert's condition is false */
|
||||
void
|
||||
nt_assert_failed(expression, filepath, line)
|
||||
const char * expression;
|
||||
const char * filepath;
|
||||
int line;
|
||||
{
|
||||
const char * filename;
|
||||
|
||||
filename = strrchr(filepath, '\\');
|
||||
filename = (filename == NULL ? filepath : filename + 1);
|
||||
|
||||
if (IsDebuggerPresent()) {
|
||||
char message[BUFSIZ];
|
||||
snprintf(message, sizeof(message),
|
||||
"nhassert(%s) failed in file '%s' at line %d",
|
||||
expression, filename, line);
|
||||
OutputDebugStringA(message);
|
||||
DebugBreak();
|
||||
}
|
||||
|
||||
/* get file name from path */
|
||||
impossible("nhassert(%s) failed in file '%s' at line %d",
|
||||
expression, filename, line);
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*winnt.c*/
|
||||
|
||||
Reference in New Issue
Block a user