]> granicus.if.org Git - nethack/commitdiff
getobj() ? fix
authorPatR <rankin@nethack.org>
Sun, 10 Apr 2016 23:16:07 +0000 (16:16 -0700)
committerPatR <rankin@nethack.org>
Sun, 10 Apr 2016 23:16:07 +0000 (16:16 -0700)
The "sortloot revamp" patch six or seven weeks ago broke filtering
for '?' menu in display_pickinv() called by getobj().  The old code
handled 'lets' when building an array of object pointers to be
sorted.  The revamp code did away with that to sort the linked list
instead, but neglected to put 'lets' handling into the subsequent
menu creation loop which is now operating on full invent rather
than the filtered subset.

doc/fixes36.1
src/invent.c

index 0592a4637ef6c6d8d53be3ccfd4c0095687a69af..6240d76d80dff7e4d46faf761ac65f4e9286cc0f 100644 (file)
@@ -206,6 +206,8 @@ when attacking a monster with a rust or corrosion or acid passive
 
 post-3.6.0: fix "object lost" panic during pickup caused by sortloot revamp
 post-3.6.0: more sortloot revisions
+post-3.6.0: fix inventory menu for response of '?' to getobj (more sortloot
+       revamp fallout)
 
 
 Platform- and/or Interface-Specific Fixes
index 1e89d406b0df3cdeb5fd89fc346b1d40a314bc78..920ea77e0bc7f91ca9502df10d9ecf140ea47802 100644 (file)
@@ -1334,10 +1334,12 @@ register const char *let, *word;
             else if (!strcmp(word, "write with"))
                 Sprintf(qbuf, "your %s", body_part(FINGERTIP));
             else if (!strcmp(word, "wield"))
-                Sprintf(qbuf, "your %s %s", uarmg ? "gloved" : "bare",
-                        makeplural(body_part(HAND)));
+                Sprintf(qbuf, "your %s %s%s", uarmg ? "gloved" : "bare",
+                        makeplural(body_part(HAND)),
+                        !uwep ? " (wielded)" : "");
             else if (!strcmp(word, "ready"))
-                Strcpy(qbuf, "empty quiver");
+                Sprintf(qbuf, "empty quiver%s",
+                        !uquiver ? " (nothing readied)" : "");
 
             if (ilet == '?' && !*lets && *altlets)
                 allowed_choices = altlets;
@@ -2232,6 +2234,8 @@ long *out_cnt;
 nextclass:
     classcount = 0;
     for (otmp = invent; otmp; otmp = otmp->nobj) {
+        if (lets && !index(lets, otmp->invlet))
+            continue;
         if (!flags.sortpack || otmp->oclass == *invlet) {
             any = zeroany; /* all bits zero */
             ilet = otmp->invlet;