venom fixes

Noticed when fixing 'D$'.  Some commands, including D, which should
have been handling venom weren't doing so.

I'm not sure whether I got all the applicable cases.
This commit is contained in:
PatR
2020-10-01 16:41:56 -07:00
parent ada5ffd627
commit 9045ccb63d
5 changed files with 51 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 do.c $NHDT-Date: 1598575088 2020/08/28 00:38:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
/* NetHack 3.7 do.c $NHDT-Date: 1601595709 2020/10/01 23:41:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -845,8 +845,9 @@ int retry;
} else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE;
n = query_category("Drop what type of items?", g.invent,
UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL | BUC_BLESSED
| BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN,
(UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL
| BUC_BLESSED | BUC_CURSED | BUC_UNCURSED
| BUC_UNKNOWN | INCLUDE_VENOM),
&pick_list, PICK_ANY);
if (!n)
goto drop_done;
@@ -897,7 +898,8 @@ int retry;
} else {
/* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", &g.invent,
(USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY,
(USE_INVLET | INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_ANY,
all_categories ? allow_all : allow_category);
if (n > 0) {
/*

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 invent.c $NHDT-Date: 1601594180 2020/10/01 23:16:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.301 $ */
/* NetHack 3.7 invent.c $NHDT-Date: 1601595710 2020/10/01 23:41:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.302 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2116,11 +2116,11 @@ unsigned *resultflags;
m_seen = TRUE;
} else if (oc_of_sym == MAXOCLASSES) {
You("don't have any %c's.", sym);
} else if (oc_of_sym != VENOM_CLASS) { /* suppress venom */
} else {
if (!index(olets, oc_of_sym)) {
add_valid_menu_class(oc_of_sym);
olets[oletct++] = oc_of_sym;
olets[oletct] = 0;
olets[oletct] = '\0';
}
}
}
@@ -2360,7 +2360,7 @@ int id_limit;
Sprintf(buf, "What would you like to identify %s?",
first ? "first" : "next");
n = query_objlist(buf, &g.invent, (SIGNAL_NOMENU | SIGNAL_ESCAPE
| USE_INVLET | INVORDER_SORT),
| USE_INVLET | INVORDER_SORT),
&pick_list, PICK_ANY, not_fully_identified);
if (n > 0) {
@@ -3217,6 +3217,7 @@ dotypeinv()
i |= BUC_CURSED;
if (xcnt)
i |= BUC_UNKNOWN;
i |= INCLUDE_VENOM;
n = query_category(prompt, g.invent, i, &pick_list, PICK_ONE);
if (!n)
return 0;
@@ -3341,7 +3342,7 @@ dotypeinv()
}
if (query_objlist((char *) 0, &g.invent,
((flags.invlet_constant ? USE_INVLET : 0)
| INVORDER_SORT),
| INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_NONE, this_type_only) > 0)
free((genericptr_t) pick_list);
return 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 pickup.c $NHDT-Date: 1596498195 2020/08/03 23:43:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.271 $ */
/* NetHack 3.7 pickup.c $NHDT-Date: 1601595711 2020/10/01 23:41:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.272 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -910,7 +910,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
int i, n;
winid win;
struct obj *curr, *last, fake_hero_object, *olist = *olist_p;
char *pack;
char *pack, packbuf[MAXOCLASSES + 1];
anything any;
boolean printed_type_name, first,
sorted = (qflags & INVORDER_SORT) != 0,
@@ -970,7 +970,9 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
* each type so we can group them. The allow function was
* called by sortloot() and will be called once per item here.
*/
pack = flags.inv_order;
pack = strcpy(packbuf, flags.inv_order);
if (qflags & INCLUDE_VENOM)
(void) strkitten(pack, VENOM_CLASS); /* venom is not in inv_order */
first = TRUE;
do {
printed_type_name = FALSE;
@@ -1095,7 +1097,7 @@ int how; /* type of query */
int n;
winid win;
struct obj *curr;
char *pack;
char *pack, packbuf[MAXOCLASSES + 1];
anything any;
boolean collected_type_name;
char invlet;
@@ -1154,7 +1156,10 @@ int how; /* type of query */
win = create_nhwindow(NHW_MENU);
start_menu(win, MENU_BEHAVE_STANDARD);
pack = flags.inv_order;
pack = strcpy(packbuf, flags.inv_order);
if (qflags & INCLUDE_VENOM)
(void) strkitten(pack, VENOM_CLASS); /* venom is not in inv_order */
if (qflags & CHOOSE_ALL) {
invlet = 'A';
@@ -2990,13 +2995,14 @@ boolean put_in;
}
}
} else {
mflags = INVORDER_SORT;
mflags = INVORDER_SORT | INCLUDE_VENOM;
if (put_in && flags.invlet_constant)
mflags |= USE_INVLET;
if (!put_in)
g.current_container->cknown = 1;
Sprintf(buf, "%s what?", action);
n = query_objlist(buf, put_in ? &g.invent : &(g.current_container->cobj),
n = query_objlist(buf,
put_in ? &g.invent : &(g.current_container->cobj),
mflags, &pick_list, PICK_ANY,
all_categories ? allow_all : allow_category);
if (n) {