fix B14021 - inconsistent menu styles

Menu styles `partial' and `full' will let you remove any type of
item from the three weapon slots via the 'A' command, but `traditional'
and `combination' would only do that for the primary weapon slot.  For
the alternate weapon and quiver slots, the item in question had to be
one which can normally be wielded or worn, otherwise when choosing the
object class letter you'd be told that it was "Not applicable."  And
for wearable items, you needed to be really wearing one of that class
(besides the quivered one) or else you'd get "not wearing any amulet"
or similar.
This commit is contained in:
nethack.rankin
2002-12-14 11:53:22 +00:00
parent 5fcbf50f2c
commit 137bd330e4
4 changed files with 35 additions and 6 deletions

View File

@@ -327,6 +327,8 @@ tengu is singular and plural, some rumors were incorrect
don't let leader or nemesis be renamed
non-moving monster are not affected by liquid
'A' command wouldn't remove cursed item from quiver or alternate weapon slot
'A' command behaved differently depending on menustyle when non-weapons were
present in the quiver or alternate weapon inventory slots
Platform- and/or Interface-Specific Fixes

View File

@@ -711,6 +711,7 @@ E char *FDECL(lcase, (char *));
E char *FDECL(upstart, (char *));
E char *FDECL(mungspaces, (char *));
E char *FDECL(eos, (char *));
E char *FDECL(strkitten, (char *,CHAR_P));
E char *FDECL(s_suffix, (const char *));
E char *FDECL(xcrypt, (const char *,char *));
E boolean FDECL(onlyspace, (const char *));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hacklib.c 3.4 1999/04/10 */
/* SCCS Id: @(#)hacklib.c 3.4 2002/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* Copyright (c) Robert Patrick Rankin, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -18,6 +18,7 @@ NetHack, except that rounddiv may call panic().
char * upstart (char *)
char * mungspaces (char *)
char * eos (char *)
char * strkitten (char *,char)
char * s_suffix (const char *)
char * xcrypt (const char *, char *)
boolean onlyspace (const char *)
@@ -130,6 +131,19 @@ eos(s) /* return the end of a string (pointing at '\0') */
return s;
}
/* strcat(s, {c,'\0'}); */
char *
strkitten(s, c) /* append a character to a string (in place) */
char *s;
char c;
{
char *p = eos(s);
*p++ = c;
*p = '\0';
return s;
}
char *
s_suffix(s) /* return a name converted to possessive */
const char *s;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)invent.c 3.4 2002/10/07 */
/* SCCS Id: @(#)invent.c 3.4 2002/12/13 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1142,6 +1142,7 @@ unsigned *resultflags;
int oletct, iletct, unpaid, oc_of_sym;
#endif
char sym, *ip, olets[MAXOCLASSES+5], ilets[MAXOCLASSES+5];
char extra_removeables[3+1]; /* uwep,uswapwep,uquiver */
char buf[BUFSZ], qbuf[QBUFSZ];
if (resultflags) *resultflags = 0;
@@ -1203,20 +1204,31 @@ unsigned *resultflags;
break;
}
extra_removeables[0] = '\0';
if (takeoff) {
/* arbitrary types of items can be placed in the weapon slots
[any duplicate entries in extra_removeables[] won't matter] */
if (uwep) (void)strkitten(extra_removeables, uwep->oclass);
if (uswapwep) (void)strkitten(extra_removeables, uswapwep->oclass);
if (uquiver) (void)strkitten(extra_removeables, uquiver->oclass);
}
ip = buf;
olets[oletct = 0] = '\0';
while ((sym = *ip++) != '\0') {
if (sym == ' ') continue;
oc_of_sym = def_char_to_objclass(sym);
if (takeoff && !(uwep && oc_of_sym == uwep->oclass) &&
(oc_of_sym != MAXOCLASSES)) {
if (!index(removeables, oc_of_sym)) {
if (takeoff && oc_of_sym != MAXOCLASSES) {
if (index(extra_removeables, oc_of_sym)) {
; /* skip rest of takeoff checks */
} else if (!index(removeables, oc_of_sym)) {
pline("Not applicable.");
return 0;
} else if (oc_of_sym == ARMOR_CLASS && !wearing_armor()) {
You("are not wearing any armor.");
return 0;
} else if (oc_of_sym == WEAPON_CLASS && !uwep && !uswapwep && !uquiver) {
} else if (oc_of_sym == WEAPON_CLASS &&
!uwep && !uswapwep && !uquiver) {
You("are not wielding anything.");
return 0;
} else if (oc_of_sym == RING_CLASS && !uright && !uleft) {