diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index 0286ad50b..8a99b181e 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -391,19 +391,11 @@ char *name; return; } -#ifdef WIN32 -boolean getreturn_enabled; -int redirect_stdout; -#endif - +#ifndef WIN32 void getreturn(str) const char *str; { -#ifdef WIN32 - if (!getreturn_enabled) - return; -#endif #ifdef TOS msmsg("Hit %s.", str); #else @@ -414,7 +406,6 @@ const char *str; return; } -#ifndef WIN32 void msmsg VA_DECL(const char *, fmt) { @@ -492,7 +483,7 @@ const char *name, *mode; return (FILE *) 0; } -#if defined(MICRO) || defined(WIN32) || defined(OS2) +#if defined(MICRO) || defined(OS2) void nethack_exit(code) int code; @@ -551,4 +542,4 @@ msexit() wait_synch(); return; } -#endif /* MICRO || WIN32 || OS2 */ +#endif /* MICRO || OS2 */ diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index c5c214f19..86432e028 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -43,6 +43,9 @@ boolean win32_cursorblink; /* globals required within here */ HANDLE ffhandle = (HANDLE) 0; WIN32_FIND_DATA ffd; +extern int GUILaunched; +boolean getreturn_enabled; +int redirect_stdout; typedef HWND(WINAPI *GETCONSOLEWINDOW)(); static HWND GetConsoleHandle(void); @@ -495,6 +498,38 @@ void nhassert_failed(const char * exp, const char * file, int line) error(message); } +void +nethack_exit(code) +int code; +{ + /* Only if we started from the GUI, not the command prompt, + * we need to get one last return, so the score board does + * not vanish instantly after being created. + * GUILaunched is defined and set in nttty.c. + */ + synch_cursor(); + if (GUILaunched) + getreturn("to end"); + synch_cursor(); + getreturn_enabled = TRUE; + wait_synch(); + exit(code); +} + +void +getreturn(str) +const char *str; +{ + char buf[BUFSZ]; + + if (!getreturn_enabled) + return; + Sprintf(buf,"Hit %s.", str); + raw_print(buf); + wait_synch(); + return; +} + /* nethack_enter_winnt() is called from main immediately after initializing the window port */ void nethack_enter_winnt()