look vs pickup
I encountered a look vs pickup cockatrice corpse bug today. If you looked at a location with ':', you would instantly get "Touching the cockatrice corpse is a fatal mistake..." but if you used "m," you got the full list of things at the location to choose from. This patch makes the behaviour consistent and more informative to the player. You now get the partial list of things felt up until the cockatrice corpse is encountered, and then you get the "Touching the cockatrice corpse is a fatal mistake..." Before, the code was never displaying the partially built list because the feel_cockatrice() call was happening before the window display call.
This commit is contained in:
@@ -797,6 +797,7 @@ E int NDECL(dotypeinv);
|
|||||||
E const char *FDECL(dfeature_at, (int,int,char *));
|
E const char *FDECL(dfeature_at, (int,int,char *));
|
||||||
E int FDECL(look_here, (int,BOOLEAN_P));
|
E int FDECL(look_here, (int,BOOLEAN_P));
|
||||||
E int NDECL(dolook);
|
E int NDECL(dolook);
|
||||||
|
E boolean FDECL(will_feel_cockatrice, (struct obj *,BOOLEAN_P));
|
||||||
E void FDECL(feel_cockatrice, (struct obj *,BOOLEAN_P));
|
E void FDECL(feel_cockatrice, (struct obj *,BOOLEAN_P));
|
||||||
E void FDECL(stackobj, (struct obj *));
|
E void FDECL(stackobj, (struct obj *));
|
||||||
E int NDECL(doprgold);
|
E int NDECL(doprgold);
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
|
|||||||
#define USE_INVLET 0x4 /* use object's invlet */
|
#define USE_INVLET 0x4 /* use object's invlet */
|
||||||
#define INVORDER_SORT 0x8 /* sort objects by packorder */
|
#define INVORDER_SORT 0x8 /* sort objects by packorder */
|
||||||
#define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */
|
#define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */
|
||||||
|
#define FEEL_COCKATRICE 0x20 /* engage cockatrice checks and react */
|
||||||
|
|
||||||
/* Flags to control query_category() */
|
/* Flags to control query_category() */
|
||||||
/* BY_NEXTHERE used by query_category() too, so skip 0x01 */
|
/* BY_NEXTHERE used by query_category() too, so skip 0x01 */
|
||||||
|
|||||||
29
src/invent.c
29
src/invent.c
@@ -2158,7 +2158,7 @@ boolean picked_some;
|
|||||||
const char *dfeature = (char *)0;
|
const char *dfeature = (char *)0;
|
||||||
char fbuf[BUFSZ], fbuf2[BUFSZ];
|
char fbuf[BUFSZ], fbuf2[BUFSZ];
|
||||||
winid tmpwin;
|
winid tmpwin;
|
||||||
boolean skip_objects = (obj_cnt >= 5);
|
boolean skip_objects = (obj_cnt >= 5), felt_cockatrice = FALSE;
|
||||||
|
|
||||||
if (u.uswallow && u.ustuck) {
|
if (u.uswallow && u.ustuck) {
|
||||||
struct monst *mtmp = u.ustuck;
|
struct monst *mtmp = u.ustuck;
|
||||||
@@ -2242,13 +2242,22 @@ boolean picked_some;
|
|||||||
putstr(tmpwin, 0, fbuf);
|
putstr(tmpwin, 0, fbuf);
|
||||||
putstr(tmpwin, 0, "");
|
putstr(tmpwin, 0, "");
|
||||||
}
|
}
|
||||||
putstr(tmpwin, 0, "Things that are here:");
|
putstr(tmpwin, 0, Blind ? "Things that you feel here:" :
|
||||||
|
"Things that are here:");
|
||||||
for ( ; otmp; otmp = otmp->nexthere) {
|
for ( ; otmp; otmp = otmp->nexthere) {
|
||||||
|
if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) {
|
||||||
|
char buf[BUFSZ];
|
||||||
|
felt_cockatrice = TRUE;
|
||||||
|
Strcpy(buf, doname(otmp));
|
||||||
|
Strcat(buf, "...");
|
||||||
|
putstr(tmpwin, 0, buf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
putstr(tmpwin, 0, doname(otmp));
|
putstr(tmpwin, 0, doname(otmp));
|
||||||
if (otmp->otyp == CORPSE) feel_cockatrice(otmp, FALSE);
|
|
||||||
}
|
}
|
||||||
display_nhwindow(tmpwin, TRUE);
|
display_nhwindow(tmpwin, TRUE);
|
||||||
destroy_nhwindow(tmpwin);
|
destroy_nhwindow(tmpwin);
|
||||||
|
if (felt_cockatrice) feel_cockatrice(otmp, FALSE);
|
||||||
read_engr_at(u.ux, u.uy); /* Eric Backus */
|
read_engr_at(u.ux, u.uy); /* Eric Backus */
|
||||||
}
|
}
|
||||||
return(!!Blind);
|
return(!!Blind);
|
||||||
@@ -2261,6 +2270,17 @@ dolook()
|
|||||||
return look_here(0, FALSE);
|
return look_here(0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
will_feel_cockatrice(otmp, force_touch)
|
||||||
|
struct obj *otmp;
|
||||||
|
boolean force_touch;
|
||||||
|
{
|
||||||
|
if ((Blind || force_touch) && !uarmg && !Stone_resistance &&
|
||||||
|
(otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm])))
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
feel_cockatrice(otmp, force_touch)
|
feel_cockatrice(otmp, force_touch)
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
@@ -2268,8 +2288,7 @@ boolean force_touch;
|
|||||||
{
|
{
|
||||||
char kbuf[BUFSZ];
|
char kbuf[BUFSZ];
|
||||||
|
|
||||||
if ((Blind || force_touch) && !uarmg && !Stone_resistance &&
|
if (will_feel_cockatrice(otmp, force_touch)) {
|
||||||
(otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]))) {
|
|
||||||
if(poly_when_stoned(youmonst.data))
|
if(poly_when_stoned(youmonst.data))
|
||||||
You("touched the %s corpse with your bare %s.",
|
You("touched the %s corpse with your bare %s.",
|
||||||
mons[otmp->corpsenm].mname, makeplural(body_part(HAND)));
|
mons[otmp->corpsenm].mname, makeplural(body_part(HAND)));
|
||||||
|
|||||||
13
src/pickup.c
13
src/pickup.c
@@ -465,8 +465,8 @@ int what; /* should be a long */
|
|||||||
pick_list[i].count = count;
|
pick_list[i].count = count;
|
||||||
} else {
|
} else {
|
||||||
n = query_objlist("Pick up what?", objchain,
|
n = query_objlist("Pick up what?", objchain,
|
||||||
traverse_how|AUTOSELECT_SINGLE|INVORDER_SORT,
|
traverse_how|AUTOSELECT_SINGLE|INVORDER_SORT|FEEL_COCKATRICE,
|
||||||
&pick_list, PICK_ANY, all_but_uchain);
|
&pick_list, PICK_ANY, all_but_uchain);
|
||||||
}
|
}
|
||||||
menu_pickup:
|
menu_pickup:
|
||||||
n_tried = n;
|
n_tried = n;
|
||||||
@@ -683,7 +683,13 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
|||||||
pack = flags.inv_order;
|
pack = flags.inv_order;
|
||||||
do {
|
do {
|
||||||
printed_type_name = FALSE;
|
printed_type_name = FALSE;
|
||||||
for (curr = olist; curr; curr = FOLLOW(curr, qflags))
|
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
||||||
|
if ((qflags & FEEL_COCKATRICE) && curr->otyp == CORPSE &&
|
||||||
|
will_feel_cockatrice(curr, FALSE)) {
|
||||||
|
destroy_nhwindow(win); /* stop the menu and revert */
|
||||||
|
look_here(0, FALSE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if ((!(qflags & INVORDER_SORT) || curr->oclass == *pack)
|
if ((!(qflags & INVORDER_SORT) || curr->oclass == *pack)
|
||||||
&& (*allow)(curr)) {
|
&& (*allow)(curr)) {
|
||||||
|
|
||||||
@@ -701,6 +707,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
|||||||
def_oc_syms[(int)objects[curr->otyp].oc_class],
|
def_oc_syms[(int)objects[curr->otyp].oc_class],
|
||||||
ATR_NONE, doname(curr), MENU_UNSELECTED);
|
ATR_NONE, doname(curr), MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pack++;
|
pack++;
|
||||||
} while (qflags & INVORDER_SORT && *pack);
|
} while (qflags & INVORDER_SORT && *pack);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user