revise curses_raw_print()
For curses, behave like tty by keeping a count of messages issued via raw_print, then if that is non-zero issue a prompt and require the player to acknowledge them before it erases the screen. Mainly so that complaints during RC file processing will be seen. For tty, force getret() to be an unconditional routine instead of sometimes a routine, sometimes a macro which calls another routine.
This commit is contained in:
@@ -207,6 +207,12 @@ curses_init_nhwindows(
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* if anything has already been output by nethack (for instance, warnings
|
||||
about RC file issues), let the player acknowlege it before initscr()
|
||||
erases the screen */
|
||||
if (iflags.raw_printed)
|
||||
curses_wait_synch();
|
||||
|
||||
#ifdef XCURSES
|
||||
base_term = Xinitscr(*argcp, argv);
|
||||
#else
|
||||
@@ -853,6 +859,23 @@ wait_synch() -- Wait until all pending output is complete (*flush*() for
|
||||
void
|
||||
curses_wait_synch(void)
|
||||
{
|
||||
if (iflags.raw_printed) {
|
||||
int chr;
|
||||
/*
|
||||
* If any message has been issued via raw_print(), make the user
|
||||
* acknowledge it. This might take place before initscr() so
|
||||
* access to curses is limited. [Despite that, there's probably
|
||||
* a more curses-specific way to handle this. FIXME?]
|
||||
*/
|
||||
|
||||
(void) fprintf(stdout, "\nPress <return> to continue: ");
|
||||
(void) fflush(stdout);
|
||||
do {
|
||||
chr = fgetc(stdin);
|
||||
} while (chr > 0 && chr != C('j') && chr != C('m') && chr != '\033');
|
||||
iflags.raw_printed = 0;
|
||||
}
|
||||
|
||||
if (iflags.window_inited) {
|
||||
if (curses_got_output())
|
||||
(void) curses_more();
|
||||
@@ -1001,12 +1024,11 @@ curses_raw_print(const char *str)
|
||||
|
||||
if (iflags.window_inited) {
|
||||
curses_message_win_puts(str, FALSE);
|
||||
} else {
|
||||
puts(str);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
puts(str);
|
||||
#endif
|
||||
puts(str);
|
||||
iflags.raw_printed++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 wintty.c $NHDT-Date: 1708290310 2024/02/18 21:05:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.386 $ */
|
||||
/* NetHack 3.7 wintty.c $NHDT-Date: 1715979847 2024/05/17 21:04:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.406 $ */
|
||||
/* Copyright (c) David Cohrs, 1991 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -208,15 +208,10 @@ boolean GFlag = FALSE;
|
||||
boolean HE_resets_AS; /* see termcap.c */
|
||||
#endif
|
||||
|
||||
#if defined(MICRO) || defined(WIN32CON)
|
||||
static const char to_continue[] = "to continue";
|
||||
#define getret() getreturn(to_continue)
|
||||
#else
|
||||
static void getret(void);
|
||||
#endif
|
||||
static void bail(const char *); /* __attribute__((noreturn)) */
|
||||
static void newclipping(coordxy, coordxy);
|
||||
static void new_status_window(void);
|
||||
static void getret(void);
|
||||
static void erase_menu_or_text(winid, struct WinDesc *, boolean);
|
||||
static void free_window_info(struct WinDesc *, boolean);
|
||||
static boolean toggle_menu_curr(winid, tty_menu_item *, int, boolean,
|
||||
@@ -770,10 +765,12 @@ tty_get_nh_event(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(MICRO) && !defined(WIN32CON)
|
||||
static void
|
||||
getret(void)
|
||||
{
|
||||
#if defined(MICRO) || defined(WIN32CON)
|
||||
getreturn("to continue");
|
||||
#else
|
||||
HUPSKIP();
|
||||
xputs("\n");
|
||||
if (flags.standout)
|
||||
@@ -784,8 +781,9 @@ getret(void)
|
||||
if (flags.standout)
|
||||
standoutend();
|
||||
xwaitforspace(" ");
|
||||
}
|
||||
#endif
|
||||
iflags.raw_printed = 0;
|
||||
}
|
||||
|
||||
void
|
||||
tty_suspend_nhwindows(const char *str)
|
||||
@@ -3965,6 +3963,8 @@ tty_raw_print(const char *str)
|
||||
HUPSKIP();
|
||||
if (ttyDisplay)
|
||||
ttyDisplay->rawprint++;
|
||||
else if (*str)
|
||||
iflags.raw_printed++;
|
||||
print_vt_code2(AVTC_SELECT_WINDOW, NHW_BASE);
|
||||
#if defined(MICRO) || defined(WIN32CON)
|
||||
msmsg("%s\n", str);
|
||||
@@ -3980,6 +3980,8 @@ tty_raw_print_bold(const char *str)
|
||||
HUPSKIP();
|
||||
if (ttyDisplay)
|
||||
ttyDisplay->rawprint++;
|
||||
else if (*str)
|
||||
iflags.raw_printed++;
|
||||
print_vt_code2(AVTC_SELECT_WINDOW, NHW_BASE);
|
||||
term_start_raw_bold();
|
||||
#if defined(MICRO) || defined(WIN32CON)
|
||||
@@ -5257,9 +5259,6 @@ play_usersound_via_idx(int idx, int volume)
|
||||
#endif
|
||||
|
||||
#undef RESIZABLE
|
||||
#ifdef getret
|
||||
#undef getret
|
||||
#endif
|
||||
#undef HUPSKIP
|
||||
#undef HUPSKIP_RESULT
|
||||
#undef ttypanic
|
||||
|
||||
Reference in New Issue
Block a user