display_pickinv
A formatting bit that grew a little. An end of line comment that
spans on two or more lines
foo(); /* call
foo() */
will confuse clang-format if the continuation lines don't begin
with an asterisk
foo(); /* call
* foo() */
Instead of just doing that, I changed display_pickinv() to add a
comment for each of its arguments.
This commit is contained in:
22
src/invent.c
22
src/invent.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 invent.c $NHDT-Date: 1608846067 2020/12/24 21:41:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.310 $ */
|
/* NetHack 3.7 invent.c $NHDT-Date: 1612738685 2021/02/07 22:58:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.318 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -2420,14 +2420,15 @@ free_pickinv_cache(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal function used by display_inventory and getobj that can display
|
* Internal function used by display_inventory and getobj that can display
|
||||||
* inventory and return a count as well as a letter. If out_cnt is not null,
|
* inventory and return a count as well as a letter.
|
||||||
* any count returned from the menu selection is placed here.
|
|
||||||
*/
|
*/
|
||||||
static char
|
static char
|
||||||
display_pickinv(register const char *lets,
|
display_pickinv(
|
||||||
const char *xtra_choice, /* "fingers", pick hands rather than
|
const char *lets, /* non-compacted list of invlet values */
|
||||||
an object */
|
const char *xtra_choice, /* non-object "bare hands" or "fingers" */
|
||||||
const char *query, boolean want_reply, long *out_cnt)
|
const char *query, /* optional; prompt string for menu */
|
||||||
|
boolean want_reply, /* True: select an item, False: just display */
|
||||||
|
long *out_cnt) /* optional; count player entered when selecting an item */
|
||||||
{
|
{
|
||||||
static const char not_carrying_anything[] = "Not carrying anything";
|
static const char not_carrying_anything[] = "Not carrying anything";
|
||||||
struct obj *otmp, wizid_fakeobj;
|
struct obj *otmp, wizid_fakeobj;
|
||||||
@@ -2475,7 +2476,7 @@ display_pickinv(register const char *lets,
|
|||||||
/* for xtra_choice, there's another 'item' not included in initial 'n';
|
/* for xtra_choice, there's another 'item' not included in initial 'n';
|
||||||
for !lets (full g.invent) and for override_ID (wizard mode identify),
|
for !lets (full g.invent) and for override_ID (wizard mode identify),
|
||||||
skip message_menu handling of single item even if item count was 1 */
|
skip message_menu handling of single item even if item count was 1 */
|
||||||
if (xtra_choice || (n == 1 && (!lets || iflags.override_ID)))
|
if (xtra_choice || (n == 1 && (!lets || wizid)))
|
||||||
++n;
|
++n;
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
@@ -2521,7 +2522,7 @@ display_pickinv(register const char *lets,
|
|||||||
|
|
||||||
start_menu(win, MENU_BEHAVE_STANDARD);
|
start_menu(win, MENU_BEHAVE_STANDARD);
|
||||||
any = cg.zeroany;
|
any = cg.zeroany;
|
||||||
if (wizard && iflags.override_ID) {
|
if (wizid) {
|
||||||
int unid_cnt;
|
int unid_cnt;
|
||||||
char prompt[QBUFSZ];
|
char prompt[QBUFSZ];
|
||||||
|
|
||||||
@@ -2565,6 +2566,7 @@ display_pickinv(register const char *lets,
|
|||||||
xtra_choice, MENU_ITEMFLAGS_NONE);
|
xtra_choice, MENU_ITEMFLAGS_NONE);
|
||||||
gotsomething = TRUE;
|
gotsomething = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextclass:
|
nextclass:
|
||||||
classcount = 0;
|
classcount = 0;
|
||||||
for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) {
|
for (srtinv = sortedinvent; (otmp = srtinv->obj) != 0; ++srtinv) {
|
||||||
@@ -2626,7 +2628,7 @@ display_pickinv(register const char *lets,
|
|||||||
not_carrying_anything, MENU_ITEMFLAGS_NONE);
|
not_carrying_anything, MENU_ITEMFLAGS_NONE);
|
||||||
want_reply = FALSE;
|
want_reply = FALSE;
|
||||||
}
|
}
|
||||||
end_menu(win, query && *query ? query : (char *) 0);
|
end_menu(win, (query && *query) ? query : (char *) 0);
|
||||||
|
|
||||||
n = select_menu(win,
|
n = select_menu(win,
|
||||||
wizid ? PICK_ANY : want_reply ? PICK_ONE : PICK_NONE,
|
wizid ? PICK_ANY : want_reply ? PICK_ONE : PICK_NONE,
|
||||||
|
|||||||
Reference in New Issue
Block a user