]> granicus.if.org Git - nethack/commitdiff
Using 'P' to put on armour or 'W' to wear a ring
authornethack.allison <nethack.allison>
Sat, 25 Jan 2003 18:41:25 +0000 (18:41 +0000)
committernethack.allison <nethack.allison>
Sat, 25 Jan 2003 18:41:25 +0000 (18:41 +0000)
resulted in "That is a silly thing to [put on | wear]".

But those two cases really aren't so "silly", so adjust
the messages to better explain why the game objected
to the action and point new players at the appropriate
command.

Also adds a cmdassist message for the case where
'R' or 'T' have no appropriate items to point
new players to the correct command. (That can be
turned off with !cmdassist, of course.)

Also adds a const to a recent shade patch by request.

doc/fixes34.1
src/do_wear.c
src/invent.c
src/uhitm.c

index d580cec63d516f8266852dc5afeafcce797e9294..e43f9498701338b8e41487881b64bee8327425e6 100644 (file)
@@ -433,4 +433,5 @@ applying a eucalyptus leaf produces a whistle effect (Malcolm Ryan)
 hobbits can wear elven mithril-coats
 eating mimics now has an hallucination effect
 prefix pickup command with 'm' to force menu of all objects present
-
+provide feedback which states the correct command when players try to use 
+       'R' or 'P' for armour, or use 'W' or 'T' for accessories
index df352fc2a965b5bbe52700cc43a57e7dbd8f41d9..620b901071c5f5c7343c7c8423dad9e5802e9865 100644 (file)
@@ -993,7 +993,8 @@ dotakeoff()
                              uskin->otyp >= GRAY_DRAGON_SCALES ?
                                "dragon scales are" : "dragon scale mail is");
                else
-                   pline("Not wearing any armor.");
+                   pline("Not wearing any armor.%s", iflags.cmdassist ?
+                       " Use 'R' command to remove accessories." : "");
                return 0;
        }
        if (armorpieces > 1)
@@ -1037,7 +1038,8 @@ doremring()
        MOREACC(ublindf);
 
        if(!Accessories) {
-               pline("Not wearing any accessories.");
+               pline("Not wearing any accessories.%s", iflags.cmdassist ?
+                       " Use 'T' command to take off non-accessories." : "");
                return(0);
        }
        if (Accessories != 1) otmp = getobj(accessories, "remove");
index 2ec4d433c0b8bd918794d7bcba2d4b4fd290c79d..c8224d63aba3d61e39a6722eec80c7b3bd15fc62 100644 (file)
@@ -20,6 +20,7 @@ STATIC_DCL boolean FDECL(putting_on, (const char *));
 STATIC_PTR int FDECL(ckunpaid,(struct obj *));
 STATIC_PTR int FDECL(ckvalidcat,(struct obj *));
 static char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *));
+STATIC_DCL void FDECL(silly_thing, (const char *,const char *,struct obj *));
 #ifdef OVLB
 STATIC_DCL boolean FDECL(this_type_only, (struct obj *));
 STATIC_DCL void NDECL(dounpaid);
@@ -1058,7 +1059,7 @@ register const char *let,*word;
           && !(usegold && otmp->oclass == COIN_CLASS)
 #endif
           ) {
-               pline(silly_thing_to, word);
+               silly_thing(let, word, otmp);
                return((struct obj *)0);
        }
        if(allowcnt == 2) {     /* cnt given */
@@ -1077,6 +1078,39 @@ register const char *let,*word;
        return(otmp);
 }
 
+STATIC_OVL void
+silly_thing(let, word, otmp)
+const char *let, *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;
+                       }
+       }
+       if (domsg)
+               pline("Use the '%s' command to %s %s%s.", s1, s2, what, s3);
+       else
+               pline(silly_thing_to, word);
+}
+
 #endif /* OVL1 */
 #ifdef OVLB
 
index 3cad55a45dd1a177a71ed557684191afebbfb640..97d142943ca7d03e0b039ec952a15f3208bcc38a 100644 (file)
@@ -912,7 +912,7 @@ int thrown;
            tmp = 0;
            if (mdat == &mons[PM_SHADE]) {
                if (!hittxt) {
-                   char *what = unconventional[0] ? unconventional : "attack";
+                   const char *what = unconventional[0] ? unconventional : "attack";
                    Your("%s %s harmlessly through %s.",
                        what, vtense(what, "pass"),
                        mon_nam(mon));