From 56c2e6349233831d6161c856233043d4b86ec301 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 22 Mar 2022 11:33:17 -0700 Subject: [PATCH] "just picked up" tweaks For menustyles traditional and combination, allow 'IP' to request inventory listing of just picked up items even if not carrying any items flagged as just picked up. The not carrying any such items feedback was already present but couldn't be triggered. For menustyles partial and full, the special menu entry for 'P' when only one item applies shows the item instead of the category "Items you just picked up". [That sort of thing probably ought to be done for every menu entry rather than just for 'P'.] Rephrase it from | P - to | P - Just picked up: in case it is player's first time seeing that category be listed. Clear the just picked up flag for any item that is dipped or read. Lots of other actions besides drop or put-into-container probably ought to do that too. [Maybe even just picking an item with getobj() could be sufficient so that it wouldn't have to be replicated all over the place.] --- src/invent.c | 4 +++- src/pickup.c | 3 ++- src/potion.c | 7 ++++++- src/read.c | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/invent.c b/src/invent.c index 559a13fcf..dcd48e662 100644 --- a/src/invent.c +++ b/src/invent.c @@ -3224,6 +3224,8 @@ dotypeinv(void) *extra_types++ = 'C'; if (!xcnt) *extra_types++ = 'X'; + if (!jcnt) + *extra_types++ = 'P'; *extra_types = '\0'; /* for index() */ for (i = 0; i < MAXOCLASSES; i++) if (!index(types, def_oc_syms[i].sym)) { @@ -3289,7 +3291,7 @@ dotypeinv(void) after = " whose blessed/uncursed/cursed status is unknown"; break; /* better phrasing is desirable */ case 'P': - after = " you just picked up"; + after = " that were just picked up"; break; default: /* 'c' is an object class, because we've already handled diff --git a/src/pickup.c b/src/pickup.c index 6bc0f6c2a..b826dab8e 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1305,7 +1305,8 @@ query_category(const char *qstr, /* query string */ char tmpbuf[BUFSZ]; if (num_justpicked == 1) - Sprintf(tmpbuf, "%s", doname(find_justpicked(olist))); + Sprintf(tmpbuf, "Just picked up: %s", + doname(find_justpicked(olist))); else Sprintf(tmpbuf, "Items you just picked up"); invlet = 'P'; diff --git a/src/potion.c b/src/potion.c index d34370446..32343989d 100644 --- a/src/potion.c +++ b/src/potion.c @@ -2209,6 +2209,7 @@ dodip(void) flags.verbose ? obuf : shortestname); /* "Dip into the fountain?" */ if (yn(qbuf) == 'y') { + obj->pickup_prev = 0; dipfountain(obj); return ECMD_TIME; } @@ -2225,6 +2226,7 @@ dodip(void) && P_SKILL(P_RIDING) < P_BASIC) { rider_cant_reach(); /* not skilled enough to reach */ } else { + obj->pickup_prev = 0; if (obj->otyp == POT_ACID) obj->in_use = 1; if (water_damage(obj, 0, TRUE) != ER_DESTROYED && obj->in_use) @@ -2244,6 +2246,8 @@ dodip(void) pline("That is a potion bottle, not a Klein bottle!"); return ECMD_OK; } + + obj->pickup_prev = 0; /* no longer 'recently picked up' */ potion->in_use = TRUE; /* assume it will be used up */ if (potion->otyp == POT_WATER) { boolean useeit = !Blind || (obj == ublindf && Blindfolded_only); @@ -2260,7 +2264,8 @@ dodip(void) /* KMH, conduct */ if (!u.uconduct.polypiles++) - livelog_printf(LL_CONDUCT, "polymorphed %s first item", uhis()); + livelog_printf(LL_CONDUCT, "polymorphed %s first item", + uhis()); obj = poly_obj(obj, STRANGE_OBJECT); diff --git a/src/read.c b/src/read.c index 4c450a88f..90fda12b0 100644 --- a/src/read.c +++ b/src/read.c @@ -356,6 +356,7 @@ doread(void) if (!scroll) return ECMD_CANCEL; otyp = scroll->otyp; + scroll->pickup_prev = 0; /* no longer 'just picked up' */ /* outrumor has its own blindness check */ if (otyp == FORTUNE_COOKIE) {