From: PatR Date: Sun, 14 Mar 2021 02:17:00 +0000 (-0800) Subject: \#perminv, 1 of 2: groundwork X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd4943129601a2482531c782852f9a744c7362e6;p=nethack \#perminv, 1 of 2: groundwork Give the window-port side of *_update_inventory() an argument. Calls in the core still omit that; invent.c's update_inventory() is the only place that cares. --- diff --git a/dat/opthelp b/dat/opthelp index 2d82a4e85..5b031eb03 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -103,8 +103,7 @@ timed_delay on unix and VMS, use a timer instead of sending [True] display effect. on MSDOS without the termcap lib, whether or not to pause for visual effect. -Boolean option for Amiga, or for others if ALTMETA was set at compile time: -altmeta For Amiga, treat Alt+key as Meta+key. [True] +Boolean option if ALTMETA was set at compile time: altmeta For unix and VMS, treat two character sequence "ESC c" as M-c (Meta+c, 8th bit set) when nethack [False] obtains a command from player's keyboard. @@ -286,18 +285,19 @@ horsename name of your starting pet if it is a pony [none] menu_* specify single character accelerators for menu commands. Here is a list of all commands with their default keystroke followed by a list of window-ports that implement them: - 'x' is X11, 't' is tty, 'g' is Gem, 'a' is Amiga. - menu_deselect_all deselect all items in a menu [-](xtga) - menu_deselect_page deselect all items on this menu page [\](tga) - menu_first_page jump to the first page in a menu [^](tga) - menu_invert_all invert all items in a menu [@](xtga) - menu_invert_page invert all items on this menu page [~](tga) - menu_last_page jump to the last page in a menu [|](tga) - menu_next_page goto the next menu page [>](tga) - menu_previous_page goto the previous menu page [<](tga) - menu_search search for a menu item [:](xtga) - menu_select_all select all items in a menu [.](xtga) - menu_select_page select all items on this menu page [,](tga) + (t is tty, c is curses, w is Windows GUI, x is X11, q is Qt) + menu_first_page jump to the first page in a menu [^](tcwxq) + menu_last_page jump to the last page in a menu [|](tcwxq) + menu_next_page advance to the next menu page [>](tcwxq) + menu_previous_page back up to the previous menu page [<](tcwxq) + menu_select_all select all items in a menu [.](tcwxq) + menu_select_page select all items on this menu page [,](tcwq) + menu_deselect_all deselect all items in a menu [-](tcwxq) + menu_deselect_page deselect all items on this menu page [\](tcwq) + menu_invert_all invert all items in a menu [@](tcwxq) + menu_invert_page invert all items on this menu page [~](tcwq) + menu_search prompt for target text and invert [:](tcwxq) + items which match that msghistory number of top line messages to save [20] name the name of your character [defaults to username on multi- user systems, asks "who are you?" on single-user systems or if diff --git a/doc/window.doc b/doc/window.doc index 6e7df40dd..1c26bf952 100644 --- a/doc/window.doc +++ b/doc/window.doc @@ -258,11 +258,12 @@ player_selection() display_file(str, boolean complain) -- Display the file named str. Complain about missing files iff complain is TRUE. -update_inventory() +update_inventory(arg) -- Indicate to the window port that the inventory has been changed. -- Merely calls display_inventory() for window-ports that leave the window up, otherwise empty. + -- 'arg' is not used yet doprev_message() -- Display previous messages. Used by the ^P command. -- On the tty-port this scrolls WIN_MESSAGE back one line. diff --git a/include/winX.h b/include/winX.h index 1ecfaf681..4fc4279bd 100644 --- a/include/winX.h +++ b/include/winX.h @@ -253,6 +253,11 @@ struct xwindow { #define DEFAULT_LINES_DISPLAYED 12 /* # of lines displayed message window */ #define MAX_HISTORY 60 /* max history saved on message window */ +/* flags for X11_yn_function_core() */ +#define YN_NORMAL 0U /* no flags */ +#define YN_NO_LOGMESG 1U /* suppress echo of prompt+response to message window + * and dumplog message history */ + /* Window variables (winX.c). */ extern struct xwindow window_list[MAX_WINDOWS]; extern XtAppContext app_context; /* context of application */ @@ -442,7 +447,7 @@ extern void X11_add_menu(winid, const glyph_info *, const ANY_P *, char, char, int, const char *, unsigned int); extern void X11_end_menu(winid, const char *); extern int X11_select_menu(winid, int, MENU_ITEM_P **); -extern void X11_update_inventory(void); +extern void X11_update_inventory(int); extern void X11_mark_synch(void); extern void X11_wait_synch(void); #ifdef CLIPPING @@ -456,6 +461,7 @@ extern int X11_nhgetch(void); extern int X11_nh_poskey(int *, int *, int *); extern void X11_nhbell(void); extern int X11_doprev_message(void); +extern char X11_yn_function_core(const char *, const char *, char, unsigned); extern char X11_yn_function(const char *, const char *, char); extern void X11_getlin(const char *, char *); extern int X11_get_ext_cmd(void); diff --git a/include/wincurs.h b/include/wincurs.h index 5cd8502a1..252af8e6e 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -87,7 +87,7 @@ extern void curses_add_menu(winid wid, const glyph_info *, const char *str, unsigned int itemflags); extern void curses_end_menu(winid wid, const char *prompt); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); -extern void curses_update_inventory(void); +extern void curses_update_inventory(int); extern void curses_mark_synch(void); extern void curses_wait_synch(void); extern void curses_cliparound(int x, int y); diff --git a/include/winprocs.h b/include/winprocs.h index ca0b0387a..581a5dbc6 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -37,7 +37,7 @@ struct window_procs { void (*win_end_menu)(winid, const char *); int (*win_select_menu)(winid, int, MENU_ITEM_P **); char (*win_message_menu)(char, int, const char *); - void (*win_update_inventory)(void); + void (*win_update_inventory)(int); void (*win_mark_synch)(void); void (*win_wait_synch)(void); #ifdef CLIPPING @@ -417,7 +417,7 @@ extern void safe_add_menu(winid, const glyph_info *, const ANY_P *, extern void safe_end_menu(winid, const char *); extern int safe_select_menu(winid, int, MENU_ITEM_P **); extern char safe_message_menu(char, int, const char *); -extern void safe_update_inventory(void); +extern void safe_update_inventory(int); extern void safe_mark_synch(void); extern void safe_wait_synch(void); #ifdef CLIPPING diff --git a/include/wintty.h b/include/wintty.h index 31b68c503..3c3d92a13 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -202,7 +202,7 @@ E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char, E void tty_end_menu(winid, const char *); E int tty_select_menu(winid, int, MENU_ITEM_P **); E char tty_message_menu(char, int, const char *); -E void tty_update_inventory(void); +E void tty_update_inventory(int); E void tty_mark_synch(void); E void tty_wait_synch(void); #ifdef CLIPPING diff --git a/src/invent.c b/src/invent.c index e1426e803..bd36622e3 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2282,13 +2282,13 @@ update_inventory(void) return; /* - * Ought to check (windowprocs.wincap2 & WC2_PERM_INVENT) here.... + * Ought to check (windowprocs.wincap & WC_PERM_INVENT) here.... * * We currently don't skip this call when iflags.perm_invent is False * because curses uses that to disable a previous perm_invent window * (after toggle via 'O'; perhaps the options code should handle that). */ - (*windowprocs.win_update_inventory)(); + (*windowprocs.win_update_inventory)(0); } /* should of course only be called for things in invent */ diff --git a/src/windows.c b/src/windows.c index 523421340..48fe2ac94 100644 --- a/src/windows.c +++ b/src/windows.c @@ -551,15 +551,14 @@ static struct window_procs hup_procs = { hup_curs, hup_putstr, hup_putstr, /* putmixed */ hup_display_file, hup_void_fdecl_winid_ulong, /* start_menu */ hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu, - hup_void_ndecl, /* update_inventory */ + hup_void_fdecl_int, /* update_inventory */ hup_void_ndecl, /* mark_synch */ hup_void_ndecl, /* wait_synch */ #ifdef CLIPPING hup_cliparound, #endif #ifdef POSITIONBAR - (void (*)(char *)) hup_void_fdecl_constchar_p, - /* update_positionbar */ + (void (*)(char *)) hup_void_fdecl_constchar_p, /* update_positionbar */ #endif hup_print_glyph, hup_void_fdecl_constchar_p, /* raw_print */ diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 9d9d9ca3b..9a525d988 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -450,10 +450,11 @@ int NetHackQtBind::qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list) return window->SelectMenu(how,menu_list); } -void NetHackQtBind::qt_update_inventory() +void NetHackQtBind::qt_update_inventory(int arg UNUSED) { if (main) main->updateInventory(); // update the paper doll inventory subset + /* doesn't work yet if (g.program_state.something_worth_saving && iflags.perm_invent) display_inventory(NULL, false); diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index d170e2b1b..aff4170b6 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -57,7 +57,7 @@ public: const char *str, unsigned int itemflags); static void qt_end_menu(winid wid, const char *prompt); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); - static void qt_update_inventory(); + static void qt_update_inventory(int); static void qt_mark_synch(); static void qt_wait_synch(); diff --git a/win/X11/winX.c b/win/X11/winX.c index f2f5a24fb..c9bf7d2b2 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -84,7 +84,7 @@ AppResources appResources; void (*input_func)(Widget, XEvent *, String *, Cardinal *); int click_x, click_y, click_button; /* Click position on a map window */ /* (filled by set_button_values()). */ -int updated_inventory; +int updated_inventory; /* used to indicate perm_invent updating */ static int (*old_error_handler) (Display *, XErrorEvent *); @@ -1239,8 +1239,9 @@ X11_destroy_nhwindow(winid window) } } +/* display persistent inventory in its own window */ void -X11_update_inventory(void) +X11_update_inventory(int arg UNUSED) { struct xwindow *wp = 0; @@ -1259,6 +1260,7 @@ X11_update_inventory(void) /* persistent inventory is up but perm_invent is off, take it down */ x11_no_perminv(wp); } + return; } /* The current implementation has all of the saved lines on the screen. */ @@ -2150,19 +2152,21 @@ release_yn_widgets(void) XtDestroyWidget(yn_popup), yn_popup = (Widget) 0; } -/* X11-specific edition of yn_function(), the routine called by the core - to show a prompt and get a single keystroke answer, often 'y' vs 'n' */ +/* guts of the X11_yn_function(), not to be confused with core code; + requires an extra argument: ynflags */ char -X11_yn_function( +X11_yn_function_core( const char *ques, /* prompt text */ const char *choices, /* allowed response chars; any char if Null */ - char def) /* default if user hits or */ + char def, /* default if user hits or */ + unsigned ynflags) /* flags; currently just log-it or not */ { static XFontStruct *yn_font = 0; static Dimension yn_minwidth = 0; char buf[BUFSZ], buf2[BUFSZ]; Arg args[4]; Cardinal num_args; + boolean suppress_logging = (ynflags & YN_NO_LOGMESG) != 0U; yn_choices = choices; /* set up globals for callback to use */ yn_def = def; @@ -2341,12 +2345,28 @@ X11_yn_function( nh_XtPopdown(yn_popup); /* this removes the event grab */ } - char *p = trimspaces(buf); /* remove !slow's extra whitespace */ - pline("%s %s", p, (yn_return == '\033') ? "ESC" : visctrl(yn_return)); + if (!suppress_logging) { + char *p = trimspaces(buf); /* remove !slow's extra whitespace */ + + pline("%s %s", p, (yn_return == '\033') ? "ESC" : visctrl(yn_return)); + } return yn_return; } +/* X11-specific edition of yn_function(), the routine called by the core + to show a prompt and get a single key answer, often 'y' vs 'n' */ +char +X11_yn_function( + const char *ques, /* prompt text */ + const char *choices, /* allowed response chars; any char if Null */ + char def) /* default if user hits or */ +{ + char res = X11_yn_function_core(ques, choices, def, YN_NORMAL); + + return res; +} + /* used when processing window-capability-specific run-time options; we support toggling tiles on and off via iflags.wc_tiled_map */ void @@ -2355,6 +2375,8 @@ X11_preference_update(const char *pref) if (!strcmp(pref, "tiled_map")) { if (WIN_MAP != WIN_ERR) display_map_window(&window_list[WIN_MAP]); + } else if (!strcmp(pref, "perm_invent")) { + ; /* TODO... */ } } diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index 020cbe2b5..a11913791 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -234,9 +234,9 @@ const char *mesg; } void -chainin_update_inventory() +chainin_update_inventory(int arg) { - (*cibase->nprocs->win_update_inventory)(cibase->ndata); + (*cibase->nprocs->win_update_inventory)(cibase->ndata, arg); } void diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index 056476ff2..894dc8a26 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -284,12 +284,11 @@ const char *mesg; } void -chainout_update_inventory(vp) -void *vp; +chainout_update_inventory(void *vp, int arg) { struct chainout_data *tdp = vp; - (*tdp->nprocs->win_update_inventory)(); + (*tdp->nprocs->win_update_inventory)(arg); } void diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index e0895a865..4bdf75192 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -500,15 +500,14 @@ const char *mesg; } void -trace_update_inventory(vp) -void *vp; +trace_update_inventory(void *vp, int arg) { struct trace_data *tdp = vp; - fprintf(wc_tracelogf, "%supdate_inventory()\n", INDENT); + fprintf(wc_tracelogf, "%supdate_inventory(%d)\n", INDENT, arg); PRE; - (*tdp->nprocs->win_update_inventory)(tdp->ndata); + (*tdp->nprocs->win_update_inventory)(tdp->ndata, arg); POST; } diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 999db17f4..a1f717963 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -50,14 +50,14 @@ typedef struct nhm { const char *prompt; /* Menu prompt text */ nhmenu_item *entries; /* Menu entries */ int num_entries; /* Number of menu entries */ - int num_pages; /* Number of display pages for entry */ + int num_pages; /* Number of display pages for menu */ int height; /* Window height of menu */ int width; /* Window width of menu */ unsigned long mbehavior; /* menu flags */ boolean reuse_accels; /* Non-unique accelerators per page */ boolean bottom_heavy; /* display multi-page menu starting at end */ - struct nhm *prev_menu; /* Pointer to previous entry */ - struct nhm *next_menu; /* Pointer to next entry */ + struct nhm *prev_menu; /* Pointer to previous menu */ + struct nhm *next_menu; /* Pointer to next menu */ } nhmenu; typedef enum menu_op_type { @@ -877,7 +877,6 @@ get_menu(winid wid) return NULL; /* Not found */ } - static char menu_get_accel(boolean first) { @@ -1301,9 +1300,138 @@ menu_display_page(nhmenu *menu, WINDOW * win, int page_num, char *selectors) wrefresh(win); } +/* split out from menu_get_selections() so that perm_invent scrolling + can be controlled from outside the normal menu activity */ +boolean +curs_nonselect_menu_action(WINDOW *win, void *menu_v, int how, + int curletter, int *curpage_p, + char selectors[256], int *num_selected_p) +{ + nhmenu_item *menu_item_ptr; + nhmenu *menu = (nhmenu *) menu_v; + boolean dismiss = FALSE; + int menucmd = (curletter <= 0 || curletter >= 255) ? curletter + : (int) (uchar) map_menu_cmd(curletter); + + switch (menucmd) { + case KEY_ESC: + *num_selected_p = -1; + dismiss = TRUE; + break; + case '\n': + case '\r': + dismiss = TRUE; + break; +#ifdef NCURSES_MOUSE_VERSION + case KEY_MOUSE: { + MEVENT mev; + + if (getmouse(&mev) == OK && how != PICK_NONE) { + if (wmouse_trafo(win, &mev.y, &mev.x, FALSE)) { + int y = mev.y; + + menu_item_ptr = get_menuitem_y(menu, win, *curpage_p, y); + + if (menu_item_ptr) { + if (how == PICK_ONE) { + menu_clear_selections(menu); + menu_select_deselect(win, menu_item_ptr, + SELECT, *curpage_p); + *num_selected_p = 1; + dismiss = TRUE; + } else { + menu_select_deselect(win, menu_item_ptr, + INVERT, *curpage_p); + } + } + } + } + break; + } /* case KEY_MOUSE */ +#endif /*NCURSES_MOUSE_VERSION*/ + case KEY_RIGHT: + case KEY_NPAGE: + case MENU_NEXT_PAGE: + case ' ': + if (*curpage_p < menu->num_pages) { + ++(*curpage_p); + menu_display_page(menu, win, *curpage_p, selectors); + } else if (menucmd == ' ') { + dismiss = TRUE; + break; + } + break; + case KEY_LEFT: + case KEY_PPAGE: + case MENU_PREVIOUS_PAGE: + if (*curpage_p > 1) { + --(*curpage_p); + menu_display_page(menu, win, *curpage_p, selectors); + } + break; + case KEY_END: + case MENU_LAST_PAGE: + if (*curpage_p != menu->num_pages) { + *curpage_p = menu->num_pages; + menu_display_page(menu, win, *curpage_p, selectors); + } + break; + case KEY_HOME: + case MENU_FIRST_PAGE: + if (*curpage_p != 1) { + *curpage_p = 1; + menu_display_page(menu, win, *curpage_p, selectors); + } + break; + case MENU_SEARCH: { + char search_key[BUFSZ]; + + search_key[0] = '\0'; + curses_line_input_dialog("Search for:", search_key, BUFSZ); + + refresh(); + touchwin(win); + wrefresh(win); + + if (!*search_key) + break; + + menu_item_ptr = menu->entries; + + while (menu_item_ptr != NULL) { + if (menu_item_ptr->identifier.a_void != NULL + && strstri(menu_item_ptr->str, search_key)) { + if (how == PICK_ONE) { + menu_clear_selections(menu); + menu_select_deselect(win, menu_item_ptr, + SELECT, *curpage_p); + *num_selected_p = 1; + dismiss = TRUE; + break; + } else { + menu_select_deselect(win, menu_item_ptr, + INVERT, *curpage_p); + } + } + menu_item_ptr = menu_item_ptr->next_item; + } + + menu_item_ptr = menu->entries; + break; + } /* case MENU_SEARCH */ + default: + if (how == PICK_NONE) { + *num_selected_p = 0; + dismiss = TRUE; + break; + } + } + + return dismiss; +} static int -menu_get_selections(WINDOW * win, nhmenu *menu, int how) +menu_get_selections(WINDOW *win, nhmenu *menu, int how) { int curletter, menucmd; int count = -1; @@ -1311,7 +1439,7 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how) int curpage = !menu->bottom_heavy ? 1 : menu->num_pages; int num_selected = 0; boolean dismiss = FALSE; - char search_key[BUFSZ], selectors[256]; + char selectors[256]; nhmenu_item *menu_item_ptr = menu->entries; menu_display_page(menu, win, curpage, selectors); @@ -1379,119 +1507,11 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how) } if (curletter <= 0 || curletter >= 256 || !selectors[curletter]) { - menucmd = (curletter <= 0 || curletter >= 255) ? curletter - : (int) (uchar) map_menu_cmd(curletter); - switch (menucmd) { - case KEY_ESC: - num_selected = -1; - dismiss = TRUE; - break; - case '\n': - case '\r': - dismiss = TRUE; - break; -#ifdef NCURSES_MOUSE_VERSION - case KEY_MOUSE: { - MEVENT mev; - - if (getmouse(&mev) == OK && how != PICK_NONE) { - if (wmouse_trafo(win, &mev.y, &mev.x, FALSE)) { - int y = mev.y; - - menu_item_ptr = get_menuitem_y(menu, win, curpage, y); - - if (menu_item_ptr) { - if (how == PICK_ONE) { - menu_clear_selections(menu); - menu_select_deselect(win, menu_item_ptr, - SELECT, curpage); - num_selected = 1; - dismiss = TRUE; - } else { - menu_select_deselect(win, menu_item_ptr, - INVERT, curpage); - } - } - } - } - } - break; -#endif /*NCURSES_MOUSE_VERSION*/ - case KEY_RIGHT: - case KEY_NPAGE: - case MENU_NEXT_PAGE: - case ' ': - if (curpage < menu->num_pages) { - curpage++; - menu_display_page(menu, win, curpage, selectors); - } else if (curletter == ' ') { - dismiss = TRUE; - break; - } - break; - case KEY_LEFT: - case KEY_PPAGE: - case MENU_PREVIOUS_PAGE: - if (curpage > 1) { - curpage--; - menu_display_page(menu, win, curpage, selectors); - } - break; - case KEY_END: - case MENU_LAST_PAGE: - if (curpage != menu->num_pages) { - curpage = menu->num_pages; - menu_display_page(menu, win, curpage, selectors); - } - break; - case KEY_HOME: - case MENU_FIRST_PAGE: - if (curpage != 1) { - curpage = 1; - menu_display_page(menu, win, curpage, selectors); - } - break; - case MENU_SEARCH: - search_key[0] = '\0'; - curses_line_input_dialog("Search for:", search_key, BUFSZ); - - refresh(); - touchwin(win); - wrefresh(win); - - if (!*search_key) - break; - - menu_item_ptr = menu->entries; - - while (menu_item_ptr != NULL) { - if (menu_item_ptr->identifier.a_void != NULL - && strstri(menu_item_ptr->str, search_key)) { - if (how == PICK_ONE) { - menu_clear_selections(menu); - menu_select_deselect(win, menu_item_ptr, - SELECT, curpage); - num_selected = 1; - dismiss = TRUE; - break; - } else { - menu_select_deselect(win, menu_item_ptr, - INVERT, curpage); - } - } - - menu_item_ptr = menu_item_ptr->next_item; - } - - menu_item_ptr = menu->entries; - break; - default: - if (how == PICK_NONE) { - num_selected = 0; - dismiss = TRUE; - break; - } - } + dismiss = curs_nonselect_menu_action(win, (void *) menu, how, + curletter, &curpage, + selectors, &num_selected); + if (num_selected == -1) + return -1; } menu_item_ptr = menu->entries; @@ -1549,7 +1569,6 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how) return num_selected; } - /* Select, deselect, or toggle selected for the given menu entry. For search operations, the toggled entry might be on a different page than the one currently shown. */ diff --git a/win/curses/cursdial.h b/win/curses/cursdial.h index 9d504bc6e..bda9508d9 100644 --- a/win/curses/cursdial.h +++ b/win/curses/cursdial.h @@ -22,5 +22,8 @@ void curses_finalize_nhmenu(winid wid, const char *prompt); int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); boolean curses_menu_exists(winid wid); void curses_del_menu(winid, boolean); +boolean curs_nonselect_menu_action(WINDOW *win, void *menu, int how, + int curletter, int *curpage_p, + char selectors[256], int *num_selected_p); #endif /* CURSDIAL_H */ diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index e22b770f5..79104a800 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -631,10 +631,10 @@ curses_select_menu(winid wid, int how, MENU_ITEM_P ** selected) } void -curses_update_inventory(void) +curses_update_inventory(int arg UNUSED) { - /* Don't do anything if perm_invent is off unless we - changed the option. */ + /* Don't do anything if perm_invent is off unless it was on and + player just changed the option. */ if (!iflags.perm_invent) { if (curses_get_nhwin(INV_WIN)) { curs_reset_windows(TRUE, FALSE); diff --git a/win/share/safeproc.c b/win/share/safeproc.c index dacf59d8a..28cfb37a7 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -67,13 +67,15 @@ struct window_procs safe_procs = { "safe-startup", 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, + {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, safe_exit_nhwindows, safe_suspend_nhwindows, safe_resume_nhwindows, safe_create_nhwindow, safe_clear_nhwindow, safe_display_nhwindow, safe_destroy_nhwindow, safe_curs, safe_putstr, safe_putmixed, safe_display_file, safe_start_menu, safe_add_menu, safe_end_menu, - safe_select_menu, safe_message_menu, safe_update_inventory, safe_mark_synch, + safe_select_menu, safe_message_menu, safe_update_inventory, + safe_mark_synch, safe_wait_synch, #ifdef CLIPPING safe_cliparound, @@ -269,7 +271,7 @@ safe_message_menu( } void -safe_update_inventory(void) +safe_update_inventory(int arg UNUSED) { return; } diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 4fbb855f2..643544b8e 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3151,9 +3151,11 @@ tty_message_menu(char let, int how, const char *mesg) return ((how == PICK_ONE && morc == let) || morc == '\033') ? morc : '\0'; } +/* update persistent inventory window */ void -tty_update_inventory(void) +tty_update_inventory(int arg UNUSED) { + /* tty doesn't support persistent inventory window */ return; } diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index a6f1db9bc..15bda0b85 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1233,9 +1233,9 @@ mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected) window up, otherwise empty. */ void -mswin_update_inventory(void) +mswin_update_inventory(int arg) { - logDebug("mswin_update_inventory()\n"); + logDebug("mswin_update_inventory(%d)\n", arg); if (iflags.perm_invent && g.program_state.something_worth_saving && iflags.window_inited && WIN_INVEN != WIN_ERR) display_inventory(NULL, FALSE); @@ -1303,7 +1303,8 @@ void mswin_print_glyph(winid wid, xchar x, xchar y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { - logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyphinfo->glyph, bkglyphinfo->glyph); + logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", + wid, x, y, glyphinfo->glyph, bkglyphinfo->glyph); if ((wid >= 0) && (wid < MAXWINDOWS) && (GetNHApp()->windowlist[wid].win != NULL)) { @@ -2058,7 +2059,7 @@ mswin_preference_update(const char *pref) } if (stricmp(pref, "perm_invent") == 0) { - mswin_update_inventory(); + mswin_update_inventory(0); return; } } @@ -3077,14 +3078,16 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percent, int color, u DISABLE_WARNING_FORMAT_NONLITERAL void -mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, unsigned long *condmasks) +mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, + int color, unsigned long *condmasks) { long cond, *condptr = (long *) ptr; char *text = (char *) ptr; MSNHMsgUpdateStatus update_cmd_data; int ochar, ci; - logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n", idx, ptr, chg, percent, color, condmasks); + logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n", + idx, ptr, chg, percent, color, condmasks); if (idx >= 0) { diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 1b2e664b4..5d6b53c50 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -161,7 +161,7 @@ void mswin_add_menu(winid wid, const glyph_info *glyphinfo, const char *str, unsigned int itemflags); void mswin_end_menu(winid wid, const char *prompt); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); -void mswin_update_inventory(void); +void mswin_update_inventory(int); void mswin_mark_synch(void); void mswin_wait_synch(void); void mswin_cliparound(int x, int y);