clean up Windows exit routines
This commit is contained in:
+3
-12
@@ -391,19 +391,11 @@ char *name;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifndef WIN32
|
||||||
boolean getreturn_enabled;
|
|
||||||
int redirect_stdout;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
getreturn(str)
|
getreturn(str)
|
||||||
const char *str;
|
const char *str;
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
|
||||||
if (!getreturn_enabled)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
#ifdef TOS
|
#ifdef TOS
|
||||||
msmsg("Hit <Return> %s.", str);
|
msmsg("Hit <Return> %s.", str);
|
||||||
#else
|
#else
|
||||||
@@ -414,7 +406,6 @@ const char *str;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
void msmsg
|
void msmsg
|
||||||
VA_DECL(const char *, fmt)
|
VA_DECL(const char *, fmt)
|
||||||
{
|
{
|
||||||
@@ -492,7 +483,7 @@ const char *name, *mode;
|
|||||||
return (FILE *) 0;
|
return (FILE *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MICRO) || defined(WIN32) || defined(OS2)
|
#if defined(MICRO) || defined(OS2)
|
||||||
void
|
void
|
||||||
nethack_exit(code)
|
nethack_exit(code)
|
||||||
int code;
|
int code;
|
||||||
@@ -551,4 +542,4 @@ msexit()
|
|||||||
wait_synch();
|
wait_synch();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* MICRO || WIN32 || OS2 */
|
#endif /* MICRO || OS2 */
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ boolean win32_cursorblink;
|
|||||||
/* globals required within here */
|
/* globals required within here */
|
||||||
HANDLE ffhandle = (HANDLE) 0;
|
HANDLE ffhandle = (HANDLE) 0;
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
|
extern int GUILaunched;
|
||||||
|
boolean getreturn_enabled;
|
||||||
|
int redirect_stdout;
|
||||||
|
|
||||||
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
typedef HWND(WINAPI *GETCONSOLEWINDOW)();
|
||||||
static HWND GetConsoleHandle(void);
|
static HWND GetConsoleHandle(void);
|
||||||
@@ -495,6 +498,38 @@ void nhassert_failed(const char * exp, const char * file, int line)
|
|||||||
error(message);
|
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 <Enter> %s.", str);
|
||||||
|
raw_print(buf);
|
||||||
|
wait_synch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* nethack_enter_winnt() is called from main immediately after
|
/* nethack_enter_winnt() is called from main immediately after
|
||||||
initializing the window port */
|
initializing the window port */
|
||||||
void nethack_enter_winnt()
|
void nethack_enter_winnt()
|
||||||
|
|||||||
Reference in New Issue
Block a user