]> granicus.if.org Git - nethack/commitdiff
pickup into quiver
authornethack.rankin <nethack.rankin>
Sat, 6 Nov 2004 01:19:25 +0000 (01:19 +0000)
committernethack.rankin <nethack.rankin>
Sat, 6 Nov 2004 01:19:25 +0000 (01:19 +0000)
     Despite lack of feedback from the beta testers about it, add the code
which tries to stack an object being added to inventory with the quiver
before trying with other carried objects.  Only matters to user if quiver
is non-empty and one or more other slot(s) are compatible with it, but
that's not uncommon for someone who starts a rogue by splitting the initial
daggers into separate wield and throw slots.  Firing a dagger from quiver
and then having it merge with wielded weapon instead of back into quiver
when picked back up leads to tedious inventory manipulation.  Assigning
different names to the two stacks solves this, but can't help when picking
up an unnamed item which is otherwise compatible.  (A rogue with starting
daggers wouldn't encounter that since unnamed ones won't be sufficiently
identified to stack, but any character who just gathers unID'd daggers and
uses them for both melee and throwing has a chance of running into the
"picked up into less desireable slot" trap whenever new ones are found.)

doc/fixes34.4
src/invent.c

index 59ae297b171eb372ba753105461d070192231659..7e779e615c4c252c63f949d5741d475aa6ccd1c5 100644 (file)
@@ -77,6 +77,8 @@ General New Features
 --------------------
 when you're teetering on the edge of a pit you can use '>' to enter the pit
 when asked for a direction, a response of '?' yields help and then asks again
+when adding an item to inventory, try to stack it with the quiver slot
+       before trying against other carried objects
 
 
 Platform- and/or Interface-Specific New Features
index e6d359674d6739e3d0f573c46b93f8fbf0657fb7..a7c2a625c3856b470a6bc01e7a324b455102ad04 100644 (file)
@@ -305,6 +305,13 @@ struct obj *obj;
            return obj;
 #endif
 
+       /* merge with quiver in preference to any other inventory slot
+          in case quiver and wielded weapon are both eligible; adding
+          extra to quivered stack is more useful than to wielded one */
+       if (uquiver && merged(&uquiver, &obj)) {
+           obj = uquiver;
+           goto added;
+       }
        /* merge if possible; find end of chain in the process */
        for (prev = 0, otmp = invent; otmp; prev = otmp, otmp = otmp->nobj)
            if (merged(&otmp, &obj)) {