]> granicus.if.org Git - nethack/commitdiff
"just picked up" tweaks
authorPatR <rankin@nethack.org>
Tue, 22 Mar 2022 18:33:17 +0000 (11:33 -0700)
committerPatR <rankin@nethack.org>
Tue, 22 Mar 2022 18:33:17 +0000 (11:33 -0700)
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 - <item>
to
| P - Just picked up: <item>
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
src/pickup.c
src/potion.c
src/read.c

index 559a13fcfee1989db6eb818d4f2ef30ae088a916..dcd48e662c5e65389866aea8b4cecbf63d5084cf 100644 (file)
@@ -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
index 6bc0f6c2a3bfddaa46d53350352d9cc2523c4b4e..b826dab8eae9dc39975ef5e9e3fd5986fd3db388 100644 (file)
@@ -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';
index d34370446129162c75c87dd30c9c7515e7dbee91..32343989d9849941ebfe746a1d2a3dd7c55aedae 100644 (file)
@@ -2209,6 +2209,7 @@ dodip(void)
                  flags.verbose ? obuf : shortestname);
         /* "Dip <the object> 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);
 
index 4c450a88fa7a5620cd1a9390c2efcbef2704ab7c..90fda12b08c7710acccf023fac0b4e9a4652f680 100644 (file)
@@ -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) {