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
+4 -1
View File
@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.316 $ $NHDT-Date: 1601594180 2020/10/01 23:16:20 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.317 $ $NHDT-Date: 1601595709 2020/10/01 23:41:49 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -227,6 +227,9 @@ hero poly'd into a mind flayer who used #monster to emit a psychic blast was
able to harm mindless monsters with it able to harm mindless monsters with it
some hero attacks that should have gotten a skill bonus or penalty didn't some hero attacks that should have gotten a skill bonus or penalty didn't
change internal name of "<foo> venom" to "splash of <foo> venom" change internal name of "<foo> venom" to "splash of <foo> venom"
some operations that made sense to handle venom ('D', scroll of identify, no
doubt others) ignored it because venom is suppressed from packorder;
matters for wizard mode or for normal play that loads wizard bones
singularize "splashes" to "splash" instead of "splashe" singularize "splashes" to "splash" instead of "splashe"
treat slinging gems and tossing or slinging stones at unicorns as attacks treat slinging gems and tossing or slinging stones at unicorns as attacks
give rot-away timer instead of revive timer to corpses of cancelled trolls give rot-away timer instead of revive timer to corpses of cancelled trolls
+22 -20
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 hack.h $NHDT-Date: 1596498538 2020/08/03 23:48:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.140 $ */ /* NetHack 3.7 hack.h $NHDT-Date: 1601595709 2020/10/01 23:41:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2017. */ /*-Copyright (c) Pasi Kallinen, 2017. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -346,27 +346,29 @@ typedef struct sortloot_item Loot;
#define ALL_FINISHED 0x01 /* called routine already finished the job */ #define ALL_FINISHED 0x01 /* called routine already finished the job */
/* flags to control query_objlist() */ /* flags to control query_objlist() */
#define BY_NEXTHERE 0x01 /* follow objlist by nexthere field */ #define BY_NEXTHERE 0x0001 /* follow objlist by nexthere field */
#define AUTOSELECT_SINGLE 0x02 /* if only 1 object, don't ask */ #define INCLUDE_VENOM 0x0002 /* include venom objects if present */
#define USE_INVLET 0x04 /* use object's invlet */ #define AUTOSELECT_SINGLE 0x0004 /* if only 1 object, don't ask */
#define INVORDER_SORT 0x08 /* sort objects by packorder */ #define USE_INVLET 0x0008 /* use object's invlet */
#define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */ #define INVORDER_SORT 0x0010 /* sort objects by packorder */
#define SIGNAL_ESCAPE 0x20 /* return -2 rather than 0 for ESC */ #define SIGNAL_NOMENU 0x0020 /* return -1 rather than 0 if none allowed */
#define FEEL_COCKATRICE 0x40 /* engage cockatrice checks and react */ #define SIGNAL_ESCAPE 0x0040 /* return -2 rather than 0 for ESC */
#define INCLUDE_HERO 0x80 /* show hero among engulfer's inventory */ #define FEEL_COCKATRICE 0x0080 /* engage cockatrice checks and react */
#define INCLUDE_HERO 0x0100 /* show hero among engulfer's inventory */
/* Flags to control query_category() */ /* Flags to control query_category() */
/* BY_NEXTHERE used by query_category() too, so skip 0x01 */ /* BY_NEXTHERE and INCLUDE_VENOM are used by query_category() too, so
#define UNPAID_TYPES 0x002 skip 0x0001 and 0x0002 */
#define GOLD_TYPES 0x004 #define UNPAID_TYPES 0x0004
#define WORN_TYPES 0x008 #define GOLD_TYPES 0x0008
#define ALL_TYPES 0x010 #define WORN_TYPES 0x0010
#define BILLED_TYPES 0x020 #define ALL_TYPES 0x0020
#define CHOOSE_ALL 0x040 #define BILLED_TYPES 0x0040
#define BUC_BLESSED 0x080 #define CHOOSE_ALL 0x0080
#define BUC_CURSED 0x100 #define BUC_BLESSED 0x0100
#define BUC_UNCURSED 0x200 #define BUC_CURSED 0x0200
#define BUC_UNKNOWN 0x400 #define BUC_UNCURSED 0x0400
#define BUC_UNKNOWN 0x0800
#define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED) #define BUC_ALLBKNOWN (BUC_BLESSED | BUC_CURSED | BUC_UNCURSED)
#define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN) #define BUCX_TYPES (BUC_ALLBKNOWN | BUC_UNKNOWN)
#define ALL_TYPES_SELECTED -2 #define ALL_TYPES_SELECTED -2
+6 -4
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) 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. */
@@ -845,8 +845,9 @@ int retry;
} else if (flags.menu_style == MENU_FULL) { } else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE; all_categories = FALSE;
n = query_category("Drop what type of items?", g.invent, n = query_category("Drop what type of items?", g.invent,
UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL | BUC_BLESSED (UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL
| BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN, | BUC_BLESSED | BUC_CURSED | BUC_UNCURSED
| BUC_UNKNOWN | INCLUDE_VENOM),
&pick_list, PICK_ANY); &pick_list, PICK_ANY);
if (!n) if (!n)
goto drop_done; goto drop_done;
@@ -897,7 +898,8 @@ int retry;
} else { } else {
/* should coordinate with perm invent, maybe not show worn items */ /* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", &g.invent, 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); all_categories ? allow_all : allow_category);
if (n > 0) { if (n > 0) {
/* /*
+6 -5
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) 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. */
@@ -2116,11 +2116,11 @@ unsigned *resultflags;
m_seen = TRUE; m_seen = TRUE;
} else if (oc_of_sym == MAXOCLASSES) { } else if (oc_of_sym == MAXOCLASSES) {
You("don't have any %c's.", sym); You("don't have any %c's.", sym);
} else if (oc_of_sym != VENOM_CLASS) { /* suppress venom */ } else {
if (!index(olets, oc_of_sym)) { if (!index(olets, oc_of_sym)) {
add_valid_menu_class(oc_of_sym); add_valid_menu_class(oc_of_sym);
olets[oletct++] = 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?", Sprintf(buf, "What would you like to identify %s?",
first ? "first" : "next"); first ? "first" : "next");
n = query_objlist(buf, &g.invent, (SIGNAL_NOMENU | SIGNAL_ESCAPE 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); &pick_list, PICK_ANY, not_fully_identified);
if (n > 0) { if (n > 0) {
@@ -3217,6 +3217,7 @@ dotypeinv()
i |= BUC_CURSED; i |= BUC_CURSED;
if (xcnt) if (xcnt)
i |= BUC_UNKNOWN; i |= BUC_UNKNOWN;
i |= INCLUDE_VENOM;
n = query_category(prompt, g.invent, i, &pick_list, PICK_ONE); n = query_category(prompt, g.invent, i, &pick_list, PICK_ONE);
if (!n) if (!n)
return 0; return 0;
@@ -3341,7 +3342,7 @@ dotypeinv()
} }
if (query_objlist((char *) 0, &g.invent, if (query_objlist((char *) 0, &g.invent,
((flags.invlet_constant ? USE_INVLET : 0) ((flags.invlet_constant ? USE_INVLET : 0)
| INVORDER_SORT), | INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_NONE, this_type_only) > 0) &pick_list, PICK_NONE, this_type_only) > 0)
free((genericptr_t) pick_list); free((genericptr_t) pick_list);
return 0; return 0;
+13 -7
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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -910,7 +910,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
int i, n; int i, n;
winid win; winid win;
struct obj *curr, *last, fake_hero_object, *olist = *olist_p; struct obj *curr, *last, fake_hero_object, *olist = *olist_p;
char *pack; char *pack, packbuf[MAXOCLASSES + 1];
anything any; anything any;
boolean printed_type_name, first, boolean printed_type_name, first,
sorted = (qflags & INVORDER_SORT) != 0, 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 * each type so we can group them. The allow function was
* called by sortloot() and will be called once per item here. * 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; first = TRUE;
do { do {
printed_type_name = FALSE; printed_type_name = FALSE;
@@ -1095,7 +1097,7 @@ int how; /* type of query */
int n; int n;
winid win; winid win;
struct obj *curr; struct obj *curr;
char *pack; char *pack, packbuf[MAXOCLASSES + 1];
anything any; anything any;
boolean collected_type_name; boolean collected_type_name;
char invlet; char invlet;
@@ -1154,7 +1156,10 @@ int how; /* type of query */
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win, MENU_BEHAVE_STANDARD); 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) { if (qflags & CHOOSE_ALL) {
invlet = 'A'; invlet = 'A';
@@ -2990,13 +2995,14 @@ boolean put_in;
} }
} }
} else { } else {
mflags = INVORDER_SORT; mflags = INVORDER_SORT | INCLUDE_VENOM;
if (put_in && flags.invlet_constant) if (put_in && flags.invlet_constant)
mflags |= USE_INVLET; mflags |= USE_INVLET;
if (!put_in) if (!put_in)
g.current_container->cknown = 1; g.current_container->cknown = 1;
Sprintf(buf, "%s what?", action); 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, mflags, &pick_list, PICK_ANY,
all_categories ? allow_all : allow_category); all_categories ? allow_all : allow_category);
if (n) { if (n) {