updated window_procs

Add a non-string identifier to window_procs for use in runtime
identification of the current window port being used.

Use a macro WPID to add the identification at the top of the
various existing window_procs declarations. It expands to the
existing text string, as well as the newly added field wp_id
with a wp_ identifier.

For example, WPID(tty) expands to: "tty", wp_tty

The generated wp_tty must be present in the wp_ids enum at
the top of include/winprocs.h.

The WINDOWPORT(x) macro has been updated to expand to a simple
value comparison (port.wp_id == wp_x), instead of a
string comparison.
This commit is contained in:
nhmall
2022-06-29 23:21:19 -04:00
parent a518d82c54
commit f228fefabd
15 changed files with 39 additions and 18 deletions

View File

@@ -1033,7 +1033,7 @@ static void Qt_positionbar(char *) {}
} // namespace nethack_qt_
struct window_procs Qt_procs = {
"Qt",
WPID(Qt),
(WC_COLOR | WC_HILITE_PET
| WC_ASCII_MAP | WC_TILED_MAP
| WC_FONT_MAP | WC_TILE_FILE | WC_TILE_WIDTH | WC_TILE_HEIGHT

View File

@@ -100,7 +100,7 @@ static XtSignalId X11_sig_id;
/* Interface definition, for windows.c */
struct window_procs X11_procs = {
"X11",
WPID(X11),
( WC_COLOR | WC_INVERSE | WC_HILITE_PET | WC_ASCII_MAP | WC_TILED_MAP
| WC_PLAYER_SELECTION | WC_PERM_INVENT | WC_MOUSE_SUPPORT ),
/* status requires VIA_WINDOWPORT(); WC2_FLUSH_STATUS ensures that */

View File

@@ -594,7 +594,7 @@ chainin_update_invent_slot(
}
struct window_procs chainin_procs = {
"-chainin", 0, /* wincap */
WPIDMINUS(chainin), 0, /* wincap */
0, /* wincap2 */
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
/*

View File

@@ -717,7 +717,7 @@ chainout_update_invent_slot(
}
struct chain_procs chainout_procs = {
"-chainout", 0, /* wincap */
WPIDMINUS(chainout), 0, /* wincap */
0, /* wincap2 */
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
/*

View File

@@ -36,7 +36,7 @@ static char *dummy_get_color_string(void);
/* Interface definition, for windows.c */
struct window_procs curses_procs = {
"curses",
WPID(curses),
(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR | WC_INVERSE
| WC_HILITE_PET
#ifdef NCURSES_MOUSE_VERSION /* (this macro name works for PDCURSES too) */

View File

@@ -66,7 +66,7 @@
*/
struct window_procs safe_procs = {
"safe-startup", 0L, 0L,
WPID(safestartup), 0L, 0L,
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
safe_init_nhwindows, safe_player_selection, safe_askname,
safe_get_nh_event,

View File

@@ -202,7 +202,7 @@ DECLB(perminvent_info *, shim_update_invent_slot,
/* Interface definition used in windows.c */
struct window_procs shim_procs = {
"shim",
WPID(shim),
(0
| WC_ASCII_MAP
| WC_COLOR | WC_HILITE_PET | WC_INVERSE | WC_EIGHT_BIT_IN),

View File

@@ -98,7 +98,7 @@ extern void msmsg(const char *, ...);
/* Interface definition, for windows.c */
struct window_procs tty_procs = {
"tty",
WPID(tty),
(0
#ifdef TTY_PERM_INVENT
| WC_PERM_INVENT

View File

@@ -79,7 +79,7 @@ strbuf_t raw_print_strbuf = { 0 };
/* Interface definition, for windows.c */
struct window_procs mswin_procs = {
"MSWIN",
WPID(mswin),
WC_COLOR | WC_HILITE_PET | WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_INVERSE
| WC_SCROLL_AMOUNT | WC_SCROLL_MARGIN | WC_MAP_MODE | WC_FONT_MESSAGE
| WC_FONT_STATUS | WC_FONT_MENU | WC_FONT_TEXT | WC_FONT_MAP