X11 persistent inventory again: initial display

If 'perm_invent' is preset in player's options, have X11 show the
persistent inventory window from the start instead of waiting for
an 'i' command.  moveloop() prolog needed a tweak do deal with it
cleanly.

Require WC_PERM_INVENT in order to honor the perm_invent option.
X11 and curses already set that, tty and curses don't support it,
so only Windows GUI needed to be updated for it.
This commit is contained in:
PatR
2021-02-14 00:57:34 -08:00
parent 36179da82f
commit 8fff588ab3
6 changed files with 24 additions and 17 deletions

View File

@@ -1,6 +1,3 @@
Starting or restoring a game with 'perm_invent' enabled via config file
or NETHACKOPTIONS does not begin with inventory shown.
When persistent inventory window is first populated, focus is given to
its window (behavior might be window manager-specific; it happens with
default window manager on OSX). Focus should be explicitly directed

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 winX.c $NHDT-Date: 1613272634 2021/02/14 03:17:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.96 $ */
/* NetHack 3.7 winX.c $NHDT-Date: 1613292827 2021/02/14 08:53:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1242,17 +1242,22 @@ X11_destroy_nhwindow(winid window)
void
X11_update_inventory(void)
{
struct xwindow *wp = 0;
if (!x_inited)
return;
if (window_list[WIN_INVEN].menu_information->is_up) {
if (iflags.perm_invent) {
if (iflags.perm_invent) {
/* skip any calls to update_inventory() before in_moveloop starts */
if (g.program_state.in_moveloop || g.program_state.gameover) {
updated_inventory = 1; /* hack to avoid mapping&raising window */
(void) display_inventory((char *) 0, FALSE);
updated_inventory = 0;
} else {
x11_no_perminv(&window_list[WIN_INVEN]);
}
} else if ((wp = &window_list[WIN_INVEN]) != 0
&& wp->type == NHW_MENU && wp->menu_information->is_up) {
/* persistent inventory is up but perm_invent is off, take it down */
x11_no_perminv(wp);
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mswproc.c $NHDT-Date: 1596498364 2020/08/03 23:46:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.153 $ */
/* NetHack 3.7 mswproc.c $NHDT-Date: 1613292828 2021/02/14 08:53:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.165 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
@@ -86,6 +86,7 @@ struct window_procs mswin_procs = {
| WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS | WC_FONTSIZ_MENU
| WC_FONTSIZ_TEXT | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE
| WC_VARY_MSGCOUNT | WC_WINDOWCOLORS | WC_PLAYER_SELECTION
| WC_PERM_INVENT
| WC_SPLASH_SCREEN | WC_POPUP_DIALOG | WC_MOUSE_SUPPORT,
#ifdef STATUS_HILITES
WC2_HITPOINTBAR | WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_HILITE_STATUS |