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:
29
src/invent.c
29
src/invent.c
@@ -2158,7 +2158,7 @@ boolean picked_some;
|
||||
const char *dfeature = (char *)0;
|
||||
char fbuf[BUFSZ], fbuf2[BUFSZ];
|
||||
winid tmpwin;
|
||||
boolean skip_objects = (obj_cnt >= 5);
|
||||
boolean skip_objects = (obj_cnt >= 5), felt_cockatrice = FALSE;
|
||||
|
||||
if (u.uswallow && u.ustuck) {
|
||||
struct monst *mtmp = u.ustuck;
|
||||
@@ -2242,13 +2242,22 @@ boolean picked_some;
|
||||
putstr(tmpwin, 0, fbuf);
|
||||
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) {
|
||||
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));
|
||||
if (otmp->otyp == CORPSE) feel_cockatrice(otmp, FALSE);
|
||||
}
|
||||
display_nhwindow(tmpwin, TRUE);
|
||||
destroy_nhwindow(tmpwin);
|
||||
if (felt_cockatrice) feel_cockatrice(otmp, FALSE);
|
||||
read_engr_at(u.ux, u.uy); /* Eric Backus */
|
||||
}
|
||||
return(!!Blind);
|
||||
@@ -2261,6 +2270,17 @@ dolook()
|
||||
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
|
||||
feel_cockatrice(otmp, force_touch)
|
||||
struct obj *otmp;
|
||||
@@ -2268,8 +2288,7 @@ boolean force_touch;
|
||||
{
|
||||
char kbuf[BUFSZ];
|
||||
|
||||
if ((Blind || force_touch) && !uarmg && !Stone_resistance &&
|
||||
(otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]))) {
|
||||
if (will_feel_cockatrice(otmp, force_touch)) {
|
||||
if(poly_when_stoned(youmonst.data))
|
||||
You("touched the %s corpse with your bare %s.",
|
||||
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;
|
||||
} else {
|
||||
n = query_objlist("Pick up what?", objchain,
|
||||
traverse_how|AUTOSELECT_SINGLE|INVORDER_SORT,
|
||||
&pick_list, PICK_ANY, all_but_uchain);
|
||||
traverse_how|AUTOSELECT_SINGLE|INVORDER_SORT|FEEL_COCKATRICE,
|
||||
&pick_list, PICK_ANY, all_but_uchain);
|
||||
}
|
||||
menu_pickup:
|
||||
n_tried = n;
|
||||
@@ -683,7 +683,13 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
pack = flags.inv_order;
|
||||
do {
|
||||
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)
|
||||
&& (*allow)(curr)) {
|
||||
|
||||
@@ -701,6 +707,7 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
|
||||
def_oc_syms[(int)objects[curr->otyp].oc_class],
|
||||
ATR_NONE, doname(curr), MENU_UNSELECTED);
|
||||
}
|
||||
}
|
||||
pack++;
|
||||
} while (qflags & INVORDER_SORT && *pack);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user