From: nethack.rankin Date: Sat, 6 Nov 2004 01:19:25 +0000 (+0000) Subject: pickup into quiver X-Git-Tag: MOVE2GIT~1408 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c090c74eec3f8ca5e62d6fbf3bb33c0d97943060;p=nethack pickup into quiver 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.) --- diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 59ae297b1..7e779e615 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/invent.c b/src/invent.c index e6d359674..a7c2a625c 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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)) {