diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 12db520d0..48fcd36ee 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -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 diff --git a/include/extern.h b/include/extern.h index f1558d659..3702eefce 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 *)); diff --git a/src/hacklib.c b/src/hacklib.c index 1e8aed692..2cd0734eb 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -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; diff --git a/src/invent.c b/src/invent.c index 9e036119b..a762d1da7 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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) {