-/* SCCS Id: @(#)do_wear.c 3.4 2003/03/10 */
+/* SCCS Id: @(#)do_wear.c 3.4 2003/05/25 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
uskin->otyp >= GRAY_DRAGON_SCALES ?
"dragon scales are" : "dragon scale mail is");
else
- pline("Not wearing any armor.%s", iflags.cmdassist ?
- " Use 'R' command to remove accessories." : "");
+ pline("Not wearing any armor.%s", (iflags.cmdassist &&
+ (uleft || uright || uamul || ublindf)) ?
+ " Use 'R' command to remove accessories." : "");
return 0;
}
if (armorpieces > 1)
MOREACC(ublindf);
if(!Accessories) {
- pline("Not wearing any accessories.%s", iflags.cmdassist ?
- " Use 'T' command to take off non-accessories." : "");
+ pline("Not wearing any accessories.%s", (iflags.cmdassist &&
+ (uarm || uarmc ||
+#ifdef TOURIST
+ uarmu ||
+#endif
+ uarms || uarmh || uarmg || uarmf)) ?
+ " Use 'T' command to take off armor." : "");
return(0);
}
if (Accessories != 1) otmp = getobj(accessories, "remove");
const char *word;
struct obj *otmp;
{
- int otyp = otmp->otyp;
- boolean domsg = FALSE;
- const char *s1, *s2, *s3;
- const char *what = (otmp->quan > 1L) ? "one of those" : "that";
- if ((!strcmp(word, "wear") || !strcmp(word, "take off")) &&
- (otmp->oclass == RING_CLASS ||
- (otmp->oclass == FOOD_CLASS && otmp->otyp == MEAT_RING) ||
- (otmp->oclass == TOOL_CLASS &&
- (otyp == BLINDFOLD || otyp == TOWEL || otyp == LENSES)))) {
- if (!strcmp(word, "wear")) {
- s1 = "P"; s2 = "put"; s3 = " on"; domsg = TRUE;
- } else {
- s1 = "R"; s2 = "remove"; s3 = ""; domsg = TRUE;
- }
- } else if ((!strcmp(word, "put on") || !strcmp(word, "remove")) &&
- (otmp->oclass == ARMOR_CLASS)) {
- if (!strcmp(word, "remove")) {
- s1 = "T"; s2 = "take"; s3 = " off"; domsg = TRUE;
- } else {
- s1 = "W"; s2 = "wear"; s3 = ""; domsg = TRUE;
- }
+ const char *s1, *s2, *s3, *what;
+ int ocls = otmp->oclass, otyp = otmp->otyp;
+
+ s1 = s2 = s3 = 0;
+ /* check for attempted use of accessory commands ('P','R') on armor
+ and for corresponding armor commands ('W','T') on accessories */
+ if (ocls == ARMOR_CLASS) {
+ if (!strcmp(word, "put on"))
+ s1 = "W", s2 = "wear", s3 = "";
+ else if (!strcmp(word, "remove"))
+ s1 = "T", s2 = "take", s3 = " off";
+ } else if ((ocls == RING_CLASS || otyp == MEAT_RING) ||
+ ocls == AMULET_CLASS ||
+ (otyp == BLINDFOLD || otyp == TOWEL || otyp == LENSES)) {
+ if (!strcmp(word, "wear"))
+ s1 = "P", s2 = "put", s3 = " on";
+ else if (!strcmp(word, "take off"))
+ s1 = "R", s2 = "remove", s3 = "";
+ }
+ if (s1) {
+ what = "that";
+ /* quantity for armor and accessory objects is always 1,
+ but some things should be referred to as plural */
+ if (otyp == LENSES || is_gloves(otmp) || is_boots(otmp))
+ what = "those";
+ pline("Use the '%s' command to %s %s%s.", s1, s2, what, s3);
+ } else {
+ pline(silly_thing_to, word);
}
- if (domsg)
- pline("Use the '%s' command to %s %s%s.", s1, s2, what, s3);
- else
- pline(silly_thing_to, word);
}
#endif /* OVL1 */