]> granicus.if.org Git - nethack/commitdiff
item-actions for 'I'
authorPatR <rankin@nethack.org>
Thu, 21 Apr 2022 06:27:45 +0000 (23:27 -0700)
committerPatR <rankin@nethack.org>
Thu, 21 Apr 2022 06:27:45 +0000 (23:27 -0700)
Support context-sensitive inventory item-actions from the class
inventory display ('I' command) as well as from regular inventory.

src/invent.c

index 8289f19ee9bbf1a0e48e53925d02f8d7f2f6864b..d139254093ba01321501c06310b36ba257ad0e65 100644 (file)
@@ -3911,8 +3911,12 @@ dotypeinv(void)
     if (query_objlist((char *) 0, &g.invent,
                       ((flags.invlet_constant ? USE_INVLET : 0)
                        | INVORDER_SORT | INCLUDE_VENOM),
-                      &pick_list, PICK_NONE, this_type_only) > 0)
+                      &pick_list, PICK_ONE, this_type_only) > 0) {
+        struct obj *otmp = pick_list[0].item.a_obj;
+
         free((genericptr_t) pick_list);
+        (void) itemactions(otmp); /* always returns ECMD_OK */
+    }
 
  doI_done:
     g.this_type = 0;