MCPcopy Create free account
hub / github.com/NetHack/NetHack / doperminv

Function doperminv

src/invent.c:2813–2857  ·  view source on GitHub ↗

the #perminv command - call interface's persistent inventory routine */

Source from the content-addressed store, hash-verified

2811
2812/* the #perminv command - call interface's persistent inventory routine */
2813int
2814doperminv(void)
2815{
2816 /*
2817 * If persistent inventory window is enabled, interact with it.
2818 *
2819 * Depending on interface, might accept and execute one scrolling
2820 * request (MENU_{FIRST,NEXT,PREVIOUS,LAST}_PAGE) then return,
2821 * or might stay and handle multiple requests until user finishes
2822 * (typically by typing <return> or <esc> but that's up to interface).
2823 */
2824
2825#if 0
2826 /* [currently this would redraw the persistent inventory window
2827 whether that's needed or not, so also reset any previous
2828 scrolling; we don't want that if the interface only accepts
2829 one scroll command at a time] */
2830 update_inventory(); /* make sure that it's up to date */
2831#endif
2832
2833 if ((windowprocs.wincap & WC_PERM_INVENT) == 0) {
2834 /* [TODO? perhaps omit "by <interface>" if all the window ports
2835 compiled into this binary lack support for perm_invent...] */
2836 pline("Persistent inventory display is not supported by '%s'.",
2837 windowprocs.name);
2838
2839 } else if (!iflags.perm_invent) {
2840 pline(
2841 "Persistent inventory ('perm_invent' option) is not presently enabled.");
2842
2843 } else if (!gi.invent) {
2844 /* [should this be left for the interface to decide?] */
2845 pline("Persistent inventory display is empty.");
2846
2847 } else {
2848 /* note: we used to request a scrolling key here and pass that to
2849 (*win_update_inventory)(key), but that limited the functionality
2850 and also cluttered message history with prompt and response so
2851 just send non-zero and have the interface be responsible for it */
2852 (*windowprocs.win_update_inventory)(1);
2853
2854 } /* iflags.perm_invent */
2855
2856 return ECMD_OK;
2857}
2858
2859/* should of course only be called for things in invent */
2860staticfn char

Callers

nothing calls this directly

Calls 2

update_inventoryFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected