implement #H4305 - Quivering wielded weapon
This ended up being more elaborate than I anticipated. 'Q' will now accept the wielded weapon as a choice of item to quiver. If that item is a stack of more than one, it will offer to split N-1 into the quiver and leave 1 wielded. If the offer is declined, or if there is already just 1, it will require confirmation to move the item from the weapon slot to the quiver slot. The alternate weapon is handled similarly, with different phrasing when in twoweapon combat mode. Just to be crystal clear: a single object cannot be in more than one weapon, alt-weapon, or quiver slot at the same time. 'Q's old behavior of rejecting the wielded weapon was to avoid accidentally becoming empty-handed, not anything to do with multiple worn/wield slots. 'Q' will also accept a count when picking an inventory item, then put 'count'-many into the quiver, leaving N-count in original stack. Except when the chosen item is already in the quiver; it that case, it undoes the stack split and leaves things as they were. (That restriction may not have been necessary but I'm not planning to revisit it....)
This commit is contained in:
10
src/invent.c
10
src/invent.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 invent.c $NHDT-Date: 1461629196 2016/04/26 00:06:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.207 $ */
|
||||
/* NetHack 3.6 invent.c $NHDT-Date: 1461967848 2016/04/29 22:10:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.208 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -16,7 +16,6 @@ STATIC_DCL void FDECL(invdisp_nothing, (const char *, const char *));
|
||||
STATIC_DCL boolean FDECL(worn_wield_only, (struct obj *));
|
||||
STATIC_DCL boolean FDECL(only_here, (struct obj *));
|
||||
STATIC_DCL void FDECL(compactify, (char *));
|
||||
STATIC_DCL boolean FDECL(splittable, (struct obj *));
|
||||
STATIC_DCL boolean FDECL(taking_off, (const char *));
|
||||
STATIC_DCL boolean FDECL(putting_on, (const char *));
|
||||
STATIC_PTR int FDECL(ckunpaid, (struct obj *));
|
||||
@@ -1042,7 +1041,7 @@ register char *buf;
|
||||
}
|
||||
|
||||
/* some objects shouldn't be split when count given to getobj or askchain */
|
||||
STATIC_OVL boolean
|
||||
boolean
|
||||
splittable(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
@@ -1163,8 +1162,9 @@ register const char *let, *word;
|
||||
|| (!strcmp(word, "wield")
|
||||
&& (otmp->owornmask & W_WEP))
|
||||
#endif
|
||||
|| (!strcmp(word, "ready") /* exclude if wielded */
|
||||
&& (otmp == uwep || (otmp == uswapwep && u.twoweap)))
|
||||
|| (!strcmp(word, "ready") /* exclude when wielded... */
|
||||
&& ((otmp == uwep || (otmp == uswapwep && u.twoweap))
|
||||
&& otmp->quan == 1L)) /* ...unless more than one */
|
||||
|| ((!strcmp(word, "dip") || !strcmp(word, "grease"))
|
||||
&& inaccessible_equipment(otmp, (const char *) 0, FALSE))
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user