diff --git a/include/extern.h b/include/extern.h index 7b518d07a..4fb9397a3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1367,6 +1367,8 @@ E char *FDECL(An, (const char *)); E char *FDECL(The, (const char *)); E char *FDECL(the, (const char *)); E char *FDECL(aobjnam, (struct obj *,const char *)); +E char *FDECL(yobjnam, (struct obj *,const char *)); +E char *FDECL(Yobjnam2, (struct obj *,const char *)); E char *FDECL(Tobjnam, (struct obj *,const char *)); E char *FDECL(otense, (struct obj *,const char *)); E char *FDECL(vtense, (const char *,const char *)); diff --git a/src/apply.c b/src/apply.c index f3f9d881c..2f7eecfd8 100644 --- a/src/apply.c +++ b/src/apply.c @@ -982,7 +982,7 @@ register struct obj *otmp; (void) get_obj_location(otmp, &x, &y, 0); if (otmp->where == OBJ_MINVENT ? cansee(x,y) : !Blind) - pline("%s %scandle%s flame%s extinguished.", + pline("%s%scandle%s flame%s extinguished.", Shk_Your(buf, otmp), (candle ? "" : "candelabrum's "), (many ? "s'" : "'s"), (many ? "s are" : " is")); @@ -1066,7 +1066,7 @@ struct obj *obj; if(obj->lamplit) { if(obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP || obj->otyp == BRASS_LANTERN) - pline("%s lamp is now off.", Shk_Your(buf, obj)); + pline("%slamp is now off.", Shk_Your(buf, obj)); else You("snuff out %s.", yname(obj)); end_burn(obj, TRUE); @@ -1087,7 +1087,7 @@ struct obj *obj; if(obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP || obj->otyp == BRASS_LANTERN) { check_unpaid(obj); - pline("%s lamp is now on.", Shk_Your(buf, obj)); + pline("%slamp is now on.", Shk_Your(buf, obj)); } else { /* candle(s) */ pline("%s flame%s %s%s", s_suffix(Yname2(obj)), @@ -1131,7 +1131,7 @@ light_cocktail(obj) return; } - You("light %s potion.%s", shk_your(buf, obj), + You("light %spotion.%s", shk_your(buf, obj), Blind ? "" : " It gives off a dim light."); if (obj->unpaid && costly_spot(u.ux, u.uy)) { /* Normally, we shouldn't both partially and fully charge @@ -1752,7 +1752,7 @@ struct obj **optr; static NEARDATA const char lubricables[] = { ALL_CLASSES, ALLOW_NONE, 0 }; static NEARDATA const char need_to_remove_outer_armor[] = - "need to remove your %s to grease your %s."; + "need to remove %s to grease %s."; STATIC_OVL void use_grease(obj) @@ -1780,16 +1780,17 @@ struct obj *obj; otmp = getobj(lubricables, "grease"); if (!otmp) return; if ((otmp->owornmask & WORN_ARMOR) && uarmc) { - Strcpy(buf, xname(uarmc)); - You(need_to_remove_outer_armor, buf, xname(otmp)); + Strcpy(buf, yname(uarmc)); + You(need_to_remove_outer_armor, buf, yname(otmp)); return; } #ifdef TOURIST if ((otmp->owornmask & WORN_SHIRT) && (uarmc || uarm)) { - Strcpy(buf, uarmc ? xname(uarmc) : ""); - if (uarmc && uarm) Strcat(buf, " and "); - Strcat(buf, uarm ? xname(uarm) : ""); - You(need_to_remove_outer_armor, buf, xname(otmp)); + Strcpy(buf, uarmc ? yname(uarmc) : ""); + if (uarmc && uarm) + Strcat(strcat(buf, " and "), xname(uarm)); + else Strcat(buf, uarm ? yname(uarm) : ""); + You(need_to_remove_outer_armor, buf, yname(otmp)); return; } #endif @@ -2011,7 +2012,7 @@ struct obj *otmp; ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP; if (otmp == trapinfo.tobj && u.ux == trapinfo.tx && u.uy == trapinfo.ty) { - You("resume setting %s %s.", + You("resume setting %s%s.", shk_your(buf, otmp), defsyms[trap_to_defsym(what_trap(ttyp))].explanation); set_occupation(set_trap, occutext, 0); @@ -2059,7 +2060,7 @@ struct obj *otmp; } } #endif - You("begin setting %s %s.", + You("begin setting %s%s.", shk_your(buf, otmp), defsyms[trap_to_defsym(what_trap(ttyp))].explanation); set_occupation(set_trap, occutext, 0); @@ -2260,8 +2261,7 @@ struct obj *obj; } else mon_hand = 0; /* lint suppression */ - You("wrap your bullwhip around %s %s.", - s_suffix(mon_nam(mtmp)), onambuf); + You("wrap your bullwhip around %s.", yname(otmp)); if (gotit && otmp->cursed) { pline("%s welded to %s %s%c", (otmp->quan == 1L) ? "It is" : "They are", @@ -2278,8 +2278,8 @@ struct obj *obj; switch (rn2(proficient + 1)) { case 2: /* to floor near you */ - You("yank %s %s to the %s!", s_suffix(mon_nam(mtmp)), - onambuf, surface(u.ux, u.uy)); + You("yank %s to the %s!", + yname(otmp), surface(u.ux, u.uy)); place_object(otmp, u.ux, u.uy); stackobj(otmp); break; @@ -2305,7 +2305,7 @@ struct obj *obj; } #endif /* 0 */ /* right into your inventory */ - You("snatch %s %s!", s_suffix(mon_nam(mtmp)), onambuf); + You("snatch %s!", yname(otmp)); if (otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]) && !uarmg && !Stone_resistance && @@ -2868,10 +2868,8 @@ doapply() /* sometimes the blessing will be worn off */ if (!rn2(49)) { if (!Blind) { - char buf[BUFSZ]; - - pline("%s %s %s.", Shk_Your(buf, obj), - aobjnam(obj, "glow"), hcolor("brown")); + pline("%s %s.", + Yobjnam2(obj, "glow"), hcolor("brown")); obj->bknown = 1; } unbless(obj); diff --git a/src/ball.c b/src/ball.c index 8cc7b473c..d4eaa6cf3 100644 --- a/src/ball.c +++ b/src/ball.c @@ -36,7 +36,7 @@ ballfall() pline("Fortunately, you are wearing a hard helmet."); dmg = 3; } else if (flags.verbose) - Your("%s does not protect you.", xname(uarmh)); + pline("%s does not protect you.", Yname2(uarmh)); } losehp(dmg, "crunched in the head by an iron ball", NO_KILLER_PREFIX); @@ -734,8 +734,8 @@ litter() nextobj = otmp->nobj; if ((otmp != uball) && (rnd(capacity) <= (int)otmp->owt)) { if (canletgo(otmp, "")) { - Your("%s you down the stairs.", - aobjnam(otmp, "follow")); + pline("%s you down the stairs.", + Yobjnam2(otmp, "follow")); dropx(otmp); } } diff --git a/src/dig.c b/src/dig.c index dff8a766d..05b273a89 100644 --- a/src/dig.c +++ b/src/dig.c @@ -240,20 +240,18 @@ dig() switch(rn2(3)) { case 0: if(!welded(uwep)) { - You("fumble and drop your %s.", xname(uwep)); + You("fumble and drop %s.", yname(uwep)); dropx(uwep); } else { #ifdef STEED if (u.usteed) - Your("%s %s and %s %s!", - xname(uwep), - otense(uwep, "bounce"), otense(uwep, "hit"), - mon_nam(u.usteed)); + pline("%s and %s %s!", + Yobjnam2(uwep, "bounce"), otense(uwep, "hit"), + mon_nam(u.usteed)); else #endif - pline("Ouch! Your %s %s and %s you!", - xname(uwep), - otense(uwep, "bounce"), otense(uwep, "hit")); + pline("Ouch! %s and %s you!", + Yobjnam2(uwep, "bounce"), otense(uwep, "hit")); set_wounded_legs(RIGHT_SIDE, 5 + rnd(5)); } break; @@ -913,8 +911,8 @@ struct obj *obj; seetrap(trap); There("is a spider web there!"); } - Your("%s entangled in the web.", - aobjnam(obj, "become")); + pline("%s entangled in the web.", + Yobjnam2(obj, "become")); /* you ought to be able to let go; tough luck */ /* (maybe `move_into_trap()' would be better) */ nomul(-d(2,2)); @@ -935,8 +933,8 @@ struct obj *obj; if (vibrate) losehp(2, "axing a hard object", KILLED_BY); } else - You("swing your %s through thin air.", - aobjnam(obj, (char *)0)); + You("swing %s through thin air.", + yobjnam(obj, (char *)0)); } else { static const char * const d_action[6] = { "swinging", @@ -977,7 +975,7 @@ struct obj *obj; } } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) { /* it must be air -- water checked above */ - You("swing your %s through thin air.", aobjnam(obj, (char *)0)); + You("swing %s through thin air.", yobjnam(obj, (char *)0)); } else if (!can_reach_floor()) { You_cant("reach the %s.", surface(u.ux,u.uy)); } else if (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) { @@ -985,8 +983,8 @@ struct obj *obj; You("cannot stay under%s long enough.", is_pool(u.ux, u.uy) ? "water" : " the lava"); } else if (!ispick) { - Your("%s merely scratches the %s.", - aobjnam(obj, (char *)0), surface(u.ux,u.uy)); + pline("%s merely scratches the %s.", + Yobjnam2(obj, (char *)0), surface(u.ux,u.uy)); u_wipe_engr(3); } else { if (digging.pos.x != u.ux || digging.pos.y != u.uy || diff --git a/src/do.c b/src/do.c index 7902db7a9..82bc87aab 100644 --- a/src/do.c +++ b/src/do.c @@ -252,8 +252,8 @@ register struct obj *obj; obj->in_use = TRUE; /* block free identification via interrupt */ switch(obj->otyp) { /* effects that can be noticed without eyes */ case RIN_SEARCHING: - You("thought your %s got lost in the sink, but there it is!", - xname(obj)); + You("thought %s got lost in the sink, but there it is!", + yname(obj)); goto giveback; case RIN_SLOW_DIGESTION: pline_The("ring is regurgitated!"); @@ -1506,10 +1506,8 @@ struct obj *corpse; case OBJ_CONTAINED: if (container_where == OBJ_MINVENT && cansee(mtmp->mx, mtmp->my) && mcarry && canseemon(mcarry) && container) { - char sackname[BUFSZ]; - Sprintf(sackname, "%s %s", s_suffix(mon_nam(mcarry)), - xname(container)); - pline("%s writhes out of %s!", Amonnam(mtmp), sackname); + pline("%s writhes out of %s!", + Amonnam(mtmp), yname(container)); } else if (container_where == OBJ_INVENT && container) { char sackname[BUFSZ]; Strcpy(sackname, an(xname(container))); diff --git a/src/dothrow.c b/src/dothrow.c index 0900c9e1a..0abc0bba9 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -796,7 +796,7 @@ boolean hitsroof; pline("Fortunately, you are wearing a hard helmet."); } else if (flags.verbose && !(obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm]))) - Your("%s does not protect you.", xname(uarmh)); + pline("%s does not protect you.", Yname2(uarmh)); } else if (obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm])) { if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { diff --git a/src/eat.c b/src/eat.c index 6b748c3cc..b42b4dea6 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1129,8 +1129,8 @@ start_tin(otmp) /* called when starting to open a tin */ default: goto no_opener; } - pline("Using your %s you try to open the tin.", - aobjnam(uwep, (char *)0)); + pline("Using %s you try to open the tin.", + yobjnam(uwep, (char *)0)); } else { no_opener: pline("It is not so easy to open this tin."); diff --git a/src/engrave.c b/src/engrave.c index d79f7876a..eefc45fe8 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -432,6 +432,7 @@ doengrave() xchar type = DUST; /* Type of engraving made */ char buf[BUFSZ]; /* Buffer for final/poly engraving text */ char ebuf[BUFSZ]; /* Buffer for initial engraving text */ + char fbuf[BUFSZ]; /* Buffer for "your fingers" */ char qbuf[QBUFSZ]; /* Buffer for query text */ char post_engr_text[BUFSZ]; /* Text displayed after engraving prompt */ const char *everb; /* Present tense of engraving type */ @@ -489,8 +490,10 @@ doengrave() otmp = getobj(styluses, "write with"); if(!otmp) return(0); /* otmp == zeroobj if fingers */ - if (otmp == &zeroobj) writer = makeplural(body_part(FINGER)); - else writer = xname(otmp); + if (otmp == &zeroobj) { + Strcat(strcpy(fbuf, "your "), makeplural(body_part(FINGER))); + writer = fbuf; + } else writer = yname(otmp); /* There's no reason you should be able to write with a wand * while both your hands are tied up. @@ -501,7 +504,7 @@ doengrave() } if (jello) { - You("tickle %s with your %s.", mon_nam(u.ustuck), writer); + You("tickle %s with %s.", mon_nam(u.ustuck), writer); Your("message dissolves..."); return(0); } @@ -510,7 +513,7 @@ doengrave() return(0); } if (IS_ALTAR(levl[u.ux][u.uy].typ)) { - You("make a motion towards the altar with your %s.", writer); + You("make a motion towards the altar with %s.", writer); altar_wrath(u.ux, u.uy); return(0); } @@ -565,7 +568,7 @@ doengrave() case FOOD_CLASS: case SCROLL_CLASS: case SPBOOK_CLASS: - Your("%s would get %s.", xname(otmp), + pline("%s would get %s.", Yname2(otmp), is_ice(u.ux,u.uy) ? "all frosty" : "too dirty"); ptext = FALSE; break; @@ -749,7 +752,8 @@ doengrave() if ((int)otmp->spe > -3) type = ENGRAVE; else - Your("%s too dull for engraving.", aobjnam(otmp,"are")); + pline("%s too dull for engraving.", + Yobjnam2(otmp, "are")); } break; @@ -776,16 +780,15 @@ doengrave() if (!Blind) You("wipe out the message here."); else - Your("%s %s %s.", xname(otmp), - otense(otmp, "get"), - is_ice(u.ux,u.uy) ? - "frosty" : "dusty"); + pline("%s %s.", Yobjnam2(otmp, "get"), + is_ice(u.ux,u.uy) ? + "frosty" : "dusty"); dengr = TRUE; } else - Your("%s can't wipe out this engraving.", - xname(otmp)); + pline("%s can't wipe out this engraving.", + Yname2(otmp)); else - Your("%s %s %s.", xname(otmp), otense(otmp, "get"), + pline("%s %s.", Yobjnam2(otmp, "get"), is_ice(u.ux,u.uy) ? "frosty" : "dusty"); break; default: @@ -1019,7 +1022,7 @@ doengrave() * However, you could now engrave "Elb", then * "ere", then "th". */ - Your("%s dull.", aobjnam(otmp, "get")); + pline("%s dull.", Yobjnam2(otmp, "get")); if (otmp->unpaid) { struct monst *shkp = shop_keeper(*u.ushops); if (shkp) { diff --git a/src/lock.c b/src/lock.c index 5ceabde2b..a1cc8c662 100644 --- a/src/lock.c +++ b/src/lock.c @@ -276,8 +276,7 @@ pick_lock(pick) /* pick a lock with a given object */ Levitation ? "here" : "there"); return 0; } else if (is_lava(u.ux, u.uy)) { - pline("Doing that would probably melt your %s.", - xname(pick)); + pline("Doing that would probably melt %s.", yname(pick)); return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { pline_The("water has no lock."); @@ -314,7 +313,8 @@ pick_lock(pick) /* pick a lock with a given object */ #ifdef TOURIST else if (picktyp == CREDIT_CARD && !otmp->olocked) { /* credit cards are only good for unlocking */ - You_cant("do that with %s.", doname(pick)); + You_cant("do that with %s.", + an(simple_typename(picktyp))); return 0; } #endif @@ -473,9 +473,9 @@ doforce() /* try to force a chest with your weapon */ if(c == 'n') continue; if(picktyp) - You("force your %s into a crack and pry.", xname(uwep)); + You("force %s into a crack and pry.", yname(uwep)); else - You("start bashing it with your %s.", xname(uwep)); + You("start bashing it with %s.", yname(uwep)); xlock.box = otmp; xlock.chance = objects[uwep->otyp].oc_wldam * 2; xlock.picktyp = picktyp; diff --git a/src/mhitm.c b/src/mhitm.c index 0a3e9ef10..9f9b3d99d 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1220,8 +1220,8 @@ register struct obj *obj; if (obj->greased && !rn2(2)) obj->greased = 0; } else { if (cansee(mdef->mx, mdef->my)) { - pline("%s %s%s!", s_suffix(Monnam(magr)), - aobjnam(obj, (is_acid ? "corrode" : "rust")), + pline("%s%s!", + Yobjnam2(obj, (is_acid ? "corrode" : "rust")), (is_acid ? obj->oeroded2 : obj->oeroded) ? " further" : ""); } diff --git a/src/mhitu.c b/src/mhitu.c index 4939a2169..6e551f1f5 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1499,7 +1499,7 @@ dopois: struct obj *obj = some_armor(&youmonst); if (drain_item(obj)) { - Your("%s less effective.", aobjnam(obj, "seem")); + pline("%s less effective.", Yobjnam2(obj, "seem")); } } break; @@ -2040,9 +2040,8 @@ register struct obj *obj; if (obj->greased && !rn2(2)) obj->greased = 0; } else { if (vis) - pline("%s %s%s!", - s_suffix(Monnam(mon)), - aobjnam(obj, (is_acid ? "corrode" : "rust")), + pline("%s%s!", + Yobjnam2(obj, (is_acid ? "corrode" : "rust")), (is_acid ? obj->oeroded2 : obj->oeroded) ? " further" : ""); if (is_acid) obj->oeroded2++; @@ -2138,8 +2137,8 @@ register struct monst *mon; xname(ring), simple_typename(ring->otyp), "ring")); makeknown(RIN_ADORNMENT); if (yn(qbuf) == 'n') continue; - } else pline("%s decides she'd like your %s, and takes it.", - Blind ? "She" : Monnam(mon), xname(ring)); + } else pline("%s decides she'd like %s, and takes it.", + Blind ? "She" : Monnam(mon), yname(ring)); makeknown(RIN_ADORNMENT); if (ring==uleft || ring==uright) Ring_gone(ring); if (ring==uwep) setuwep((struct obj *)0); @@ -2148,8 +2147,6 @@ register struct monst *mon; freeinv(ring); (void) mpickobj(mon,ring); } else { - char buf[BUFSZ]; - if (uleft && uright && uleft->otyp == RIN_ADORNMENT && uright->otyp==RIN_ADORNMENT) break; @@ -2162,8 +2159,8 @@ register struct monst *mon; makeknown(RIN_ADORNMENT); if (yn(qbuf) == 'n') continue; } else { - pline("%s decides you'd look prettier wearing your %s,", - Blind ? "He" : Monnam(mon), xname(ring)); + pline("%s decides you'd look prettier wearing %s,", + Blind ? "He" : Monnam(mon), yname(ring)); pline("and puts it on your finger."); } makeknown(RIN_ADORNMENT); @@ -2176,15 +2173,13 @@ register struct monst *mon; Blind ? "He" : Monnam(mon), the(xname(ring)), body_part(HAND)); setworn(ring, LEFT_RING); } else if (uright && uright->otyp != RIN_ADORNMENT) { - Strcpy(buf, xname(uright)); - pline("%s replaces your %s with your %s.", - Blind ? "He" : Monnam(mon), buf, xname(ring)); + pline("%s replaces %s with %s.", + Blind ? "He" : Monnam(mon), yname(uright), yname(ring)); Ring_gone(uright); setworn(ring, RIGHT_RING); } else if (uleft && uleft->otyp != RIN_ADORNMENT) { - Strcpy(buf, xname(uleft)); - pline("%s replaces your %s with your %s.", - Blind ? "He" : Monnam(mon), buf, xname(ring)); + pline("%s replaces %s with %s.", + Blind ? "He" : Monnam(mon), yname(uleft), yname(ring)); Ring_gone(uleft); setworn(ring, LEFT_RING); } else impossible("ring replacement"); diff --git a/src/mon.c b/src/mon.c index d0a1794fd..b58aeb29c 100644 --- a/src/mon.c +++ b/src/mon.c @@ -316,8 +316,7 @@ warn_effects() if (warnlevel == 100) { if(!Blind && uwep && (warnlevel > lastwarnlev || moves > lastwarntime + warnDelay)) { - Your("%s %s!", aobjnam(uwep, "glow"), - hcolor(NH_LIGHT_BLUE)); + pline("%s %s!", Yobjnam2(uwep, "glow"), hcolor(NH_LIGHT_BLUE)); lastwarnlev = warnlevel; lastwarntime = moves; } diff --git a/src/muse.c b/src/muse.c index ed8b56028..7e92ad71b 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1424,8 +1424,8 @@ struct monst *mtmp; pline("Fortunately, you are wearing a hard helmet."); if (dmg > 2) dmg = 2; } else if (flags.verbose) { - Your("%s does not protect you.", - xname(uarmh)); + pline("%s does not protect you.", + Yname2(uarmh)); } } } else diff --git a/src/objnam.c b/src/objnam.c index 5dadeb7e9..0b5f5e014 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1011,6 +1011,39 @@ register const char *verb; return(bp); } +/* combine yname and aobjnam eg "your count cxname(otmp)" */ +char * +yobjnam(obj,verb) +struct obj *obj; +const char *verb; +{ + char *s = aobjnam(obj, verb); + + /* leave off "your" for most of your artifacts, but prepend + * "your" for unique objects and "foo of bar" quest artifacts */ + if (!carried(obj) || !obj_is_pname(obj) || + obj->oartifact >= ART_ORB_OF_DETECTION) { + char *outbuf = shk_your(nextobuf(), obj); + int space_left = BUFSZ - 1 - strlen(outbuf); + + s = strncat(outbuf, s, space_left); + } + + return s; +} + +/* combine Yname2 and aobjnam eg "Your count cxname(otmp)" */ +char * +Yobjnam2(obj,verb) +struct obj *obj; +const char *verb; +{ + register char *s = yobjnam(obj,verb); + + *s = highc(*s); + return(s); +} + /* like aobjnam, but prepend "The", not count, and use xname */ char * Tobjnam(otmp, verb) @@ -1166,16 +1199,24 @@ register struct obj *obj; return(s); } -/* returns "your xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */ +/* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */ char * yname(obj) struct obj *obj; { - char *outbuf = nextobuf(); - char *s = shk_your(outbuf, obj); /* assert( s == outbuf ); */ - int space_left = BUFSZ - strlen(s) - sizeof " "; + char *s = cxname(obj); - return strncat(strcat(s, " "), cxname(obj), space_left); + /* leave off "your" for most of your artifacts, but prepend + * "your" for unique objects and "foo of bar" quest artifacts */ + if (!carried(obj) || !obj_is_pname(obj) || + obj->oartifact >= ART_ORB_OF_DETECTION) { + char *outbuf = shk_your(nextobuf(), obj); + int space_left = BUFSZ - 1 - strlen(outbuf); + + s = strncat(outbuf, s, space_left); + } + + return s; } /* capitalized variant of yname() */ @@ -1199,9 +1240,9 @@ struct obj *obj; { char *outbuf = nextobuf(); char *s = shk_your(outbuf, obj); /* assert( s == outbuf ); */ - int space_left = BUFSZ - strlen(s) - sizeof " "; + int space_left = BUFSZ - 1 - strlen(s); - return strncat(strcat(s, " "), simple_typename(obj->otyp), space_left); + return strncat(s, simple_typename(obj->otyp), space_left); } /* capitalized variant of ysimple_name() */ diff --git a/src/pickup.c b/src/pickup.c index ef4d5eb62..6c2529858 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2500,7 +2500,7 @@ struct obj *box; /* or bag */ observe_quantum_cat(box); if (!Has_contents(box)) /* evidently a live cat came out */ /* container type of "large box" is inferred */ - pline("%s box is now empty.", Shk_Your(yourbuf, box)); + pline("%sbox is now empty.", Shk_Your(yourbuf, box)); else /* holds cat corpse or other random stuff */ empty_it = TRUE; } else if (!Has_contents(box)) { diff --git a/src/polyself.c b/src/polyself.c index 75dd37875..ff4babac4 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -629,12 +629,12 @@ break_armor() if (has_horns(youmonst.data)) { if ((otmp = uarmh) != 0) { if (is_flimsy(otmp) && !donning(otmp)) { - char hornbuf[BUFSZ], yourbuf[BUFSZ]; + char hornbuf[BUFSZ]; /* Future possiblities: This could damage/destroy helmet */ Sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data))); - Your("%s %s through %s %s.", hornbuf, vtense(hornbuf, "pierce"), - shk_your(yourbuf, otmp), xname(otmp)); + Your("%s %s through %s.", + hornbuf, vtense(hornbuf, "pierce"), yname(otmp)); } else { if (donning(otmp)) cancel_don(); Your("helmet falls to the %s!", surface(u.ux, u.uy)); diff --git a/src/potion.c b/src/potion.c index 1ad5abe2f..743cf50a9 100644 --- a/src/potion.c +++ b/src/potion.c @@ -530,7 +530,7 @@ peffects(otmp) case SPE_INVISIBILITY: /* spell cannot penetrate mummy wrapping */ if (BInvis && uarmc->otyp == MUMMY_WRAPPING) { - You_feel("rather itchy under your %s.", xname(uarmc)); + You_feel("rather itchy under %s.", yname(uarmc)); break; } /* FALLTHRU */ @@ -1423,22 +1423,20 @@ get_wet(obj) register struct obj *obj; /* returns TRUE if something happened (potion should be used up) */ { - char Your_buf[BUFSZ]; - if (snuff_lit(obj)) return(TRUE); if (obj->greased) { grease_protect(obj,(char *)0,&youmonst); return(FALSE); } - (void) Shk_Your(Your_buf, obj); + /* (Rusting shop goods ought to be charged for.) */ switch (obj->oclass) { case WEAPON_CLASS: if (!obj->oerodeproof && is_rustprone(obj) && (obj->oeroded < MAX_ERODE) && !rn2(2)) { - pline("%s %s some%s.", - Your_buf, aobjnam(obj, "rust"), + pline("%s some%s.", + Yobjnam2(obj, "rust"), obj->oeroded ? " more" : "what"); obj->oeroded++; update_inventory(); @@ -1455,7 +1453,7 @@ register struct obj *obj; update_inventory(); return (TRUE); } - pline("%s %s%s.", Your_buf, aobjnam(obj,"dilute"), + pline("%s%s.", Yobjnam2(obj,"dilute"), obj->odiluted ? " further" : ""); if(obj->unpaid && costly_spot(u.ux, u.uy)) { You("dilute it, you pay for it."); @@ -1515,7 +1513,7 @@ register struct obj *obj; return TRUE; } } - pline("%s %s wet.", Your_buf, aobjnam(obj,"get")); + pline("%s wet.", Yobjnam2(obj, "get")); return FALSE; } @@ -1528,7 +1526,7 @@ dodip() uchar here; char allowall[2]; short mixture; - char qbuf[QBUFSZ], Your_buf[BUFSZ]; + char qbuf[QBUFSZ]; allowall[0] = ALL_CLASSES; allowall[1] = '\0'; if(!(obj = getobj(allowall, "dip"))) @@ -1569,13 +1567,11 @@ dodip() potion->in_use = TRUE; /* assume it will be used up */ if(potion->otyp == POT_WATER) { boolean useeit = !Blind; - if (useeit) (void) Shk_Your(Your_buf, obj); if (potion->blessed) { if (obj->cursed) { if (useeit) - pline("%s %s %s.", - Your_buf, - aobjnam(obj, "softly glow"), + pline("%s %s.", + Yobjnam2(obj, "softly glow"), hcolor(NH_AMBER)); uncurse(obj); obj->bknown=1; @@ -1588,9 +1584,8 @@ dodip() } else if(!obj->blessed) { if (useeit) { tmp = hcolor(NH_LIGHT_BLUE); - pline("%s %s with a%s %s aura.", - Your_buf, - aobjnam(obj, "softly glow"), + pline("%s with a%s %s aura.", + Yobjnam2(obj, "softly glow"), index(vowels, *tmp) ? "n" : "", tmp); } bless(obj); @@ -1600,9 +1595,8 @@ dodip() } else if (potion->cursed) { if (obj->blessed) { if (useeit) - pline("%s %s %s.", - Your_buf, - aobjnam(obj, "glow"), + pline("%s %s.", + Yobjnam2(obj, "glow"), hcolor((const char *)"brown")); unbless(obj); obj->bknown=1; @@ -1610,9 +1604,8 @@ dodip() } else if(!obj->cursed) { if (useeit) { tmp = hcolor(NH_BLACK); - pline("%s %s with a%s %s aura.", - Your_buf, - aobjnam(obj, "glow"), + pline("%s with a%s %s aura.", + Yobjnam2(obj, "glow"), index(vowels, *tmp) ? "n" : "", tmp); } curse(obj); @@ -1982,7 +1975,7 @@ struct monst *mon, /* monster being split */ reason[0] = '\0'; if (mtmp) Sprintf(reason, " from %s heat", - (mtmp == &youmonst) ? (const char *)"your" : + (mtmp == &youmonst) ? the_your[1] : (const char *)s_suffix(mon_nam(mtmp))); if (mon == &youmonst) { diff --git a/src/pray.c b/src/pray.c index 084f6d702..db14672f7 100644 --- a/src/pray.c +++ b/src/pray.c @@ -271,8 +271,8 @@ register int trouble; int i; struct obj *otmp = 0; const char *what = (const char *)0; - static NEARDATA const char leftglow[] = "left ring softly glows", - rightglow[] = "right ring softly glows"; + static NEARDATA const char leftglow[] = "Your left ring softly glows", + rightglow[] = "Your right ring softly glows"; switch (trouble) { case TROUBLE_STONED: @@ -400,9 +400,9 @@ decurse: } uncurse(otmp); if (!Blind) { - Your("%s %s.", what ? what : - (const char *)aobjnam(otmp, "softly glow"), - hcolor(NH_AMBER)); + pline("%s %s.", what ? what : + (const char *)Yobjnam2(otmp, "softly glow"), + hcolor(NH_AMBER)); otmp->bknown = TRUE; } update_inventory(); @@ -450,9 +450,7 @@ decurse: otmp = which_armor(u.usteed, W_SADDLE); uncurse(otmp); if (!Blind) { - pline("%s %s %s.", - s_suffix(upstart(y_monnam(u.usteed))), - aobjnam(otmp, "softly glow"), + pline("%s %s.", Yobjnam2(otmp, "softly glow"), hcolor(NH_AMBER)); otmp->bknown = TRUE; } @@ -870,20 +868,20 @@ pleased(g_align) uncurse(uwep); uwep->bknown = TRUE; if (!Blind) - Your("%s %s%s.", aobjnam(uwep, "softly glow"), - hcolor(NH_AMBER), repair_buf); - else You_feel("the power of %s over your %s.", - u_gname(), xname(uwep)); + pline("%s %s%s.", Yobjnam2(uwep, "softly glow"), + hcolor(NH_AMBER), repair_buf); + else You_feel("the power of %s over %s.", + u_gname(), yname(uwep)); *repair_buf = '\0'; } else if (!uwep->blessed) { bless(uwep); uwep->bknown = TRUE; if (!Blind) - Your("%s with %s aura%s.", - aobjnam(uwep, "softly glow"), - an(hcolor(NH_LIGHT_BLUE)), repair_buf); - else You_feel("the blessing of %s over your %s.", - u_gname(), xname(uwep)); + pline("%s with %s aura%s.", + Yobjnam2(uwep, "softly glow"), + an(hcolor(NH_LIGHT_BLUE)), repair_buf); + else You_feel("the blessing of %s over %s.", + u_gname(), yname(uwep)); *repair_buf = '\0'; } @@ -894,8 +892,8 @@ pleased(g_align) /* only give this message if we didn't just bless or uncurse (which has already given a message) */ if (*repair_buf) - Your("%s as good as new!", - aobjnam(uwep, Blind ? "feel" : "look")); + pline("%s as good as new!", + Yobjnam2(uwep, Blind ? "feel" : "look")); } update_inventory(); } @@ -951,8 +949,8 @@ pleased(g_align) if (otmp->cursed) { uncurse(otmp); if (!Blind) { - Your("%s %s.", aobjnam(otmp, "softly glow"), - hcolor(NH_AMBER)); + pline("%s %s.", Yobjnam2(otmp, "softly glow"), + hcolor(NH_AMBER)); otmp->bknown = TRUE; ++any; } diff --git a/src/read.c b/src/read.c index c0ca11c11..394786752 100644 --- a/src/read.c +++ b/src/read.c @@ -149,35 +149,36 @@ doread() } return(1); } + STATIC_OVL void stripspe(obj) register struct obj *obj; { if (obj->blessed) pline(nothing_happens); else { - if (obj->spe > 0) { - obj->spe = 0; - if (obj->otyp == OIL_LAMP || obj->otyp == BRASS_LANTERN) - obj->age = 0; - Your("%s %s briefly.",xname(obj), otense(obj, "vibrate")); - } else pline(nothing_happens); + if (obj->spe > 0) { + obj->spe = 0; + if (obj->otyp == OIL_LAMP || obj->otyp == BRASS_LANTERN) + obj->age = 0; + pline("%s briefly.", Yobjnam2(obj, "vibrate")); + } else pline(nothing_happens); } } + STATIC_OVL void p_glow1(otmp) register struct obj *otmp; { - Your("%s %s briefly.", xname(otmp), - otense(otmp, Blind ? "vibrate" : "glow")); + pline("%s briefly.", Yobjnam2(otmp, Blind ? "vibrate" : "glow")); } + STATIC_OVL void p_glow2(otmp,color) register struct obj *otmp; register const char *color; { - Your("%s %s%s%s for a moment.", - xname(otmp), - otense(otmp, Blind ? "vibrate" : "glow"), + pline("%s%s%s for a moment.", + Yobjnam2(otmp, Blind ? "vibrate" : "glow"), Blind ? "" : " ", Blind ? nul : hcolor(color)); } @@ -270,8 +271,8 @@ int curse_bless; /* destruction depends on current state, not adjustment */ if (obj->spe > rn2(7) || obj->spe <= -5) { - Your("%s %s momentarily, then %s!", - xname(obj), otense(obj,"pulsate"), otense(obj,"explode")); + pline("%s momentarily, then %s!", + Yobjnam2(obj, "pulsate"), otense(obj,"explode")); if (is_on) Ring_gone(obj); s = rnd(3 * abs(obj->spe)); /* amount of damage */ useup(obj); @@ -279,8 +280,8 @@ int curse_bless; } else { long mask = is_on ? (obj == uleft ? LEFT_RING : RIGHT_RING) : 0L; - Your("%s spins %sclockwise for a moment.", - xname(obj), s < 0 ? "counter" : ""); + pline("%s spins %sclockwise for a moment.", + Yname2(obj), s < 0 ? "counter" : ""); /* cause attributes and/or properties to be updated */ if (is_on) Ring_off(obj); obj->spe += s; /* update the ring while it's off */ @@ -679,12 +680,12 @@ register struct obj *sobj; otmp->oerodeproof = !(sobj->cursed); if(Blind) { otmp->rknown = FALSE; - Your("%s %s warm for a moment.", - xname(otmp), otense(otmp, "feel")); + pline("%s warm for a moment.", + Yobjnam2(otmp, "feel")); } else { otmp->rknown = TRUE; - Your("%s %s covered by a %s %s %s!", - xname(otmp), otense(otmp, "are"), + pline("%s covered by a %s %s %s!", + Yobjnam2(otmp, "are"), sobj->cursed ? "mottled" : "shimmering", hcolor(sobj->cursed ? NH_BLACK : NH_GOLDEN), sobj->cursed ? "glow" : @@ -693,9 +694,8 @@ register struct obj *sobj; if (otmp->oerodeproof && (otmp->oeroded || otmp->oeroded2)) { otmp->oeroded = otmp->oeroded2 = 0; - Your("%s %s as good as new!", - xname(otmp), - otense(otmp, Blind ? "feel" : "look")); + pline("%s as good as new!", + Yobjnam2(otmp, Blind ? "feel" : "look")); } break; } @@ -716,8 +716,8 @@ register struct obj *sobj; /* KMH -- catch underflow */ s = sobj->cursed ? -otmp->spe : otmp->spe; if (s > (special_armor ? 5 : 3) && rn2(s)) { - Your("%s violently %s%s%s for a while, then %s.", - xname(otmp), + pline("%s violently %s%s%s for a while, then %s.", + Yname2(otmp), otense(otmp, Blind ? "vibrate" : "glow"), (!Blind && !same_color) ? " " : nul, (Blind || same_color) ? nul : @@ -738,7 +738,7 @@ register struct obj *sobj; if (s >= 0 && otmp->otyp >= GRAY_DRAGON_SCALES && otmp->otyp <= YELLOW_DRAGON_SCALES) { /* dragon scales get turned into dragon scale mail */ - Your("%s merges and hardens!", xname(otmp)); + pline("%s merges and hardens!", Yname2(otmp)); setworn((struct obj *)0, W_ARM); /* assumes same order */ otmp->otyp = GRAY_DRAGON_SCALE_MAIL + @@ -752,8 +752,8 @@ register struct obj *sobj; setworn(otmp, W_ARM); break; } - Your("%s %s%s%s%s for a %s.", - xname(otmp), + pline("%s %s%s%s%s for a %s.", + Yname2(otmp), s == 0 ? "violently " : nul, otense(otmp, Blind ? "vibrate" : "glow"), (!Blind && !same_color) ? " " : nul, @@ -770,8 +770,8 @@ register struct obj *sobj; if ((otmp->spe > (special_armor ? 5 : 3)) && (special_armor || !rn2(7))) - Your("%s suddenly %s %s.", - xname(otmp), otense(otmp, "vibrate"), + pline("%s %s.", + Yobjnam2(otmp, "suddenly vibrate"), Blind ? "again" : "unexpectedly"); break; } @@ -798,7 +798,7 @@ register struct obj *sobj; } else known = TRUE; } else { /* armor and scroll both cursed */ - Your("%s %s.", xname(otmp), otense(otmp, "vibrate")); + pline("%s.", Yobjnam2(otmp, "vibrate")); if (otmp->spe >= -6) otmp->spe--; make_stunned(HStun + rn1(10, 10), TRUE); } @@ -967,16 +967,16 @@ register struct obj *sobj; Your("weapon feels warm for a moment."); } else { uwep->rknown = TRUE; - Your("%s covered by a %s %s %s!", - aobjnam(uwep, "are"), + pline("%s covered by a %s %s %s!", + Yobjnam2(uwep, "are"), sobj->cursed ? "mottled" : "shimmering", hcolor(sobj->cursed ? NH_PURPLE : NH_GOLDEN), sobj->cursed ? "glow" : "shield"); } if (uwep->oerodeproof && (uwep->oeroded || uwep->oeroded2)) { uwep->oeroded = uwep->oeroded2 = 0; - Your("%s as good as new!", - aobjnam(uwep, Blind ? "feel" : "look")); + pline("%s as good as new!", + Yobjnam2(uwep, Blind ? "feel" : "look")); } } else return !chwepon(sobj, sobj->cursed ? -1 : @@ -1256,8 +1256,8 @@ register struct obj *sobj; pline("Fortunately, you are wearing a hard helmet."); if (dmg > 2) dmg = 2; } else if (flags.verbose) { - Your("%s does not protect you.", - xname(uarmh)); + pline("%s does not protect you.", + Yname2(uarmh)); } } } else @@ -1311,7 +1311,7 @@ wand_explode(obj) register struct obj *obj; { obj->in_use = TRUE; /* in case losehp() is fatal */ - Your("%s vibrates violently, and explodes!",xname(obj)); + pline("%s vibrates violently, and explodes!", Yname2(obj)); nhbell(); losehp(rnd(2*(u.uhpmax+1)/3), "exploding wand", KILLED_BY_AN); useup(obj); diff --git a/src/shk.c b/src/shk.c index acef77df5..15c7f2acf 100644 --- a/src/shk.c +++ b/src/shk.c @@ -3964,14 +3964,15 @@ register xchar x, y; return(FALSE); } +/* "your " or "Foobar's " (note the trailing space) */ char * shk_your(buf, obj) char *buf; struct obj *obj; { if (!shk_owns(buf, obj) && !mon_owns(buf, obj)) - Strcpy(buf, carried(obj) ? "your" : "the"); - return buf; + Strcpy(buf, the_your[carried(obj) ? 1 : 0]); + return strcat(buf, " "); } char * @@ -3996,7 +3997,7 @@ struct obj *obj; (obj->unpaid || (obj->where==OBJ_FLOOR && !obj->no_charge && costly_spot(x,y)))) { shkp = shop_keeper(inside_shop(x, y)); - return strcpy(buf, shkp ? s_suffix(shkname(shkp)) : "the"); + return strcpy(buf, shkp ? s_suffix(shkname(shkp)) : the_your[0]); } return (char *)0; } @@ -4007,7 +4008,7 @@ char *buf; struct obj *obj; { if (obj->where == OBJ_MINVENT) - return strcpy(buf, s_suffix(mon_nam(obj->ocarry))); + return strcpy(buf, s_suffix(y_monnam(obj->ocarry))); return (char *)0; } diff --git a/src/sit.c b/src/sit.c index deb1c110c..150b90d1f 100644 --- a/src/sit.c +++ b/src/sit.c @@ -372,9 +372,8 @@ rndcurse() /* curse a few inventory items at random! */ else curse(otmp); if (!Blind) { - pline("%s %s %s.", - s_suffix(upstart(y_monnam(u.usteed))), - aobjnam(otmp, "glow"), + pline("%s %s.", + Yobjnam2(otmp, "glow"), hcolor(otmp->cursed ? NH_BLACK : (const char *)"brown")); otmp->bknown = TRUE; } diff --git a/src/steal.c b/src/steal.c index f03e3d808..b59483d68 100644 --- a/src/steal.c +++ b/src/steal.c @@ -314,10 +314,11 @@ gotobj: if (ostuck || !can_carry(mtmp, otmp)) { static const char * const how[] = { "steal","snatch","grab","take" }; cant_take: - pline("%s tries to %s your %s but gives up.", + pline("%s tries to %s %s%s but gives up.", Monnam(mtmp), how[rn2(SIZE(how))], + (otmp->owornmask & W_ARMOR) ? "your " : "", (otmp->owornmask & W_ARMOR) ? equipname(otmp) : - cxname(otmp)); + yname(otmp)); /* the fewer items you have, the less likely the thief is going to stick around to try again (0) instead of running away (1) */ diff --git a/src/timeout.c b/src/timeout.c index 832815a4d..3a70b9277 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -777,7 +777,7 @@ long timeout; /* only interested in INVENT, FLOOR, and MINVENT */ if (get_obj_location(obj, &x, &y, 0)) { canseeit = !Blind && cansee(x, y); - /* set up `whose[]' to be "Your" or "Fred's" or "The goblin's" */ + /* set `whose[]' to be "Your " or "Fred's " or "The goblin's " */ (void) Shk_Your(whose, obj); } else { canseeit = FALSE; @@ -792,7 +792,7 @@ long timeout; switch (obj->where) { case OBJ_INVENT: case OBJ_MINVENT: - pline("%s potion of oil has burnt away.", + pline("%spotion of oil has burnt away.", whose); break; case OBJ_FLOOR: @@ -830,8 +830,8 @@ long timeout; switch (obj->where) { case OBJ_INVENT: case OBJ_MINVENT: - pline("%s %s seems about to go out.", - whose, xname(obj)); + pline("%s seems about to go out.", + Yname2(obj)); break; case OBJ_FLOOR: You("see %s about to go out.", @@ -849,11 +849,10 @@ long timeout; case OBJ_INVENT: case OBJ_MINVENT: if (obj->otyp == BRASS_LANTERN) - pline("%s lantern has run out of power.", + pline("%slantern has run out of power.", whose); else - pline("%s %s has gone out.", - whose, xname(obj)); + pline("%s has gone out.", Yname2(obj)); break; case OBJ_FLOOR: if (obj->otyp == BRASS_LANTERN) @@ -890,7 +889,7 @@ long timeout; switch (obj->where) { case OBJ_INVENT: case OBJ_MINVENT: - pline("%s %scandle%s getting short.", + pline("%s%scandle%s getting short.", whose, menorah ? "candelabrum's " : "", many ? "s are" : " is"); @@ -910,7 +909,7 @@ long timeout; case OBJ_INVENT: case OBJ_MINVENT: pline( - "%s %scandle%s flame%s flicker%s low!", + "%s%scandle%s flame%s flicker%s low!", whose, menorah ? "candelabrum's " : "", many ? "s'" : "'s", @@ -934,9 +933,8 @@ long timeout; switch (obj->where) { case OBJ_INVENT: case OBJ_MINVENT: - pline("%s candelabrum's flame%s.", - whose, - many ? "s die" : " dies"); + pline("%scandelabrum's flame%s.", + whose, many ? "s die" : " dies"); break; case OBJ_FLOOR: You("see a candelabrum's flame%s die.", @@ -947,9 +945,8 @@ long timeout; switch (obj->where) { case OBJ_INVENT: case OBJ_MINVENT: - pline("%s %s %s consumed!", - whose, - xname(obj), + pline("%s %s consumed!", + Yname2(obj), many ? "are" : "is"); break; case OBJ_FLOOR: diff --git a/src/trap.c b/src/trap.c index 5b93573c9..429c2c045 100644 --- a/src/trap.c +++ b/src/trap.c @@ -202,11 +202,8 @@ struct monst *victim; else if (vismon) pline("%s's %s %s %s", Monnam(victim), ostr, vtense(ostr, "are"), txt); - } else { - if (victim == &youmonst) - Your("%s %s",aobjnam(otmp,"are"), txt); - else if (vismon) - pline("%s's %s %s", Monnam(victim), aobjnam(otmp,"are"), txt); + } else if ((victim == &youmonst) || vismon) { + pline("%s %s", Yobjnam2(otmp, "are"), txt); } if (!rn2(2)) { otmp->greased = 0; @@ -697,7 +694,7 @@ unsigned trflags; pline("Fortunately, you are wearing a hard helmet."); dmg = 2; } else if (flags.verbose) { - Your("%s does not protect you.", xname(uarmh)); + pline("%s does not protect you.", Yname2(uarmh)); } } @@ -3895,7 +3892,7 @@ lava_effects() if(is_organic(obj) && !obj->oerodeproof) { if(obj->owornmask) { if (usurvive) - Your("%s into flame!", aobjnam(obj, "burst")); + pline("%s into flame!", Yobjnam2(obj, "burst")); if(obj == uarm) (void) Armor_gone(); else if(obj == uarmc) (void) Cloak_off(); @@ -3945,7 +3942,7 @@ burn_stuff: if(uarmf && !uarmf->oerodeproof && is_organic(uarmf)) { /* save uarmf value because Boots_off() sets uarmf to null */ obj = uarmf; - Your("%s bursts into flame!", xname(obj)); + pline("%s into flame!", Yobjnam2(obj, "burst")); (void) Boots_off(); useup(obj); } diff --git a/src/uhitm.c b/src/uhitm.c index 9614311c0..6325121ba 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -379,8 +379,8 @@ register struct monst *mtmp; unweapon = FALSE; if(flags.verbose) { if(uwep) - You("begin bashing monsters with your %s.", - aobjnam(uwep, (char *)0)); + You("begin bashing monsters with %s.", + yobjnam(uwep, (char *)0)); else if (!cantwield(youmonst.data)) You("begin %sing monsters with your %s %s.", Role_if(PM_MONK) ? "strik" : "bash", @@ -607,9 +607,9 @@ int thrown; rnl(4) == 4-1) { boolean more_than_1 = (obj->quan > 1L); - pline("As you hit %s, %s%s %s breaks into splinters.", + pline("As you hit %s, %s%s breaks into splinters.", mon_nam(mon), more_than_1 ? "one of " : "", - shk_your(yourbuf, obj), xname(obj)); + yname(obj)); if (!more_than_1) uwepgone(); /* set unweapon */ useup(obj); if (!more_than_1) obj = (struct obj *) 0; @@ -647,9 +647,8 @@ int thrown; setmnotwielded(mon,monwep); MON_NOWEP(mon); mon->weapon_check = NEED_WEAPON; - pline("%s %s %s from the force of your blow!", - s_suffix(Monnam(mon)), xname(monwep), - otense(monwep, "shatter")); + pline("%s from the force of your blow!", + Yobjnam2(monwep, "shatter")); m_useup(mon, monwep); /* If someone just shattered MY weapon, I'd flee! */ if (rn2(4)) { @@ -718,7 +717,7 @@ int thrown; break; case MIRROR: if (breaktest(obj)) { - You("break %s mirror. That's bad luck!", + You("break %smirror. That's bad luck!", shk_your(yourbuf, obj)); change_luck(-2); useup(obj); @@ -731,7 +730,7 @@ int thrown; break; #ifdef TOURIST case EXPENSIVE_CAMERA: - You("succeed in destroying %s camera. Congratulations!", + You("succeed in destroying %scamera. Congratulations!", shk_your(yourbuf, obj)); useup(obj); return(TRUE); @@ -927,8 +926,7 @@ int thrown; } if (obj && !rn2(nopoison)) { obj->opoisoned = FALSE; - Your("%s %s no longer poisoned.", xname(obj), - otense(obj, "are")); + pline("%s no longer poisoned.", Yobjnam2(obj, "are")); } if (resists_poison(mon)) needpoismsg = TRUE; @@ -959,7 +957,7 @@ int thrown; You("joust %s%s", mon_nam(mon), canseemon(mon) ? exclam(tmp) : "."); if (jousting < 0) { - Your("%s shatters on impact!", xname(obj)); + pline("%s shatters on impact!", Yname2(obj)); /* (must be either primary or secondary weapon to get here) */ u.twoweap = FALSE; /* untwoweapon() is too verbose here */ if (obj == uwep) uwepgone(); /* set unweapon */ @@ -2392,7 +2390,7 @@ struct attack *mattk; /* null means we find one internally */ if (!mon->mcan) { if (drain_item(obj) && carried(obj) && (obj->known || obj->oclass == ARMOR_CLASS)) { - Your("%s less effective.", aobjnam(obj, "seem")); + pline("%s less effective.", Yobjnam2(obj, "seem")); } break; } diff --git a/src/weapon.c b/src/weapon.c index a3e4407d4..44c8c82f8 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -630,9 +630,7 @@ register struct monst *mon; } else { pline("%s tries to wield %s.", Monnam(mon), doname(obj)); - pline("%s %s %s!", - s_suffix(Monnam(mon)), - xname(mw_tmp), welded_buf); + pline("%s %s!", yname(mw_tmp), welded_buf); } mw_tmp->bknown = 1; } diff --git a/src/wield.c b/src/wield.c index d261960d6..7b2028574 100644 --- a/src/wield.c +++ b/src/wield.c @@ -423,11 +423,8 @@ const char *verb; /* "rub",&c */ strstri(what, "s of ") != 0); if (obj->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL)) { - char yourbuf[BUFSZ]; - - You_cant("%s %s %s while wearing %s.", - verb, shk_your(yourbuf, obj), what, - more_than_1 ? "them" : "it"); + You_cant("%s %s while wearing %s.", + verb, yname(obj), more_than_1 ? "them" : "it"); return FALSE; } if (welded(uwep)) { @@ -498,8 +495,8 @@ can_twoweapon() } else if (uarms) You_cant("use two weapons while wearing a shield."); else if (uswapwep->oartifact) - pline("%s %s being held second to another weapon!", - Yname2(uswapwep), otense(uswapwep, "resist")); + pline("%s being held second to another weapon!", + Yobjnam2(uswapwep, "resist")); else if (!uarmg && !Stone_resistance && (uswapwep->otyp == CORPSE && touch_petrifies(&mons[uswapwep->corpsenm]))) { char kbuf[BUFSZ]; @@ -525,7 +522,7 @@ drop_uswapwep() /* Avoid trashing makeplural's static buffer */ Strcpy(str, makeplural(body_part(HAND))); - Your("%s from your %s!", aobjnam(obj, "slip"), str); + pline("%s from your %s!", Yobjnam2(obj, "slip"), str); dropx(obj); } @@ -631,13 +628,8 @@ boolean fade_scrolls; ) { if (!Blind) { - if (victim == &youmonst) - Your("%s.", aobjnam(target, "fade")); - else if (vismon) - pline("%s's %s.", Monnam(victim), - aobjnam(target, "fade")); - else if (visobj) - pline_The("%s.", aobjnam(target, "fade")); + if ((victim == &youmonst) || vismon || visobj) + pline("%s.", Yobjnam2(target, "fade")); } target->otyp = SCR_BLANK_PAPER; target->spe = 0; @@ -645,27 +637,14 @@ boolean fade_scrolls; } else if (target->oerodeproof || (acid_dmg ? !is_corrodeable(target) : !is_rustprone(target))) { if (flags.verbose || !(target->oerodeproof && target->rknown)) { - if (victim == &youmonst) - Your("%s not affected.", aobjnam(target, "are")); - else if (vismon) - pline("%s's %s not affected.", Monnam(victim), - aobjnam(target, "are")); + if ((victim == &youmonst) || vismon) + pline("%s not affected.", Yobjnam2(target, "are")); /* no message if not carried */ } if (target->oerodeproof) target->rknown = TRUE; } else if (erosion < MAX_ERODE) { - if (victim == &youmonst) - Your("%s%s!", aobjnam(target, acid_dmg ? "corrode" : "rust"), - erosion+1 == MAX_ERODE ? " completely" : - erosion ? " further" : ""); - else if (vismon) - pline("%s's %s%s!", Monnam(victim), - aobjnam(target, acid_dmg ? "corrode" : "rust"), - erosion+1 == MAX_ERODE ? " completely" : - erosion ? " further" : ""); - else if (visobj) - pline_The("%s%s!", - aobjnam(target, acid_dmg ? "corrode" : "rust"), + if ((victim == &youmonst) || vismon || visobj) + pline("%s%s!", Yobjnam2(target, acid_dmg ? "corrode" : "rust"), erosion+1 == MAX_ERODE ? " completely" : erosion ? " further" : ""); if (acid_dmg) @@ -675,16 +654,12 @@ boolean fade_scrolls; } else { if (flags.verbose) { if (victim == &youmonst) - Your("%s completely %s.", - aobjnam(target, Blind ? "feel" : "look"), + pline("%s completely %s.", + Yobjnam2(target, Blind ? "feel" : "look"), acid_dmg ? "corroded" : "rusty"); - else if (vismon) - pline("%s's %s completely %s.", Monnam(victim), - aobjnam(target, "look"), - acid_dmg ? "corroded" : "rusty"); - else if (visobj) - pline_The("%s completely %s.", - aobjnam(target, "look"), + else if (vismon || visobj) + pline("%s completely %s.", + Yobjnam2(target, "look"), acid_dmg ? "corroded" : "rusty"); } } @@ -730,27 +705,27 @@ register int amount; if (amount < 0 && uwep->oartifact && restrict_name(uwep, ONAME(uwep))) { if (!Blind) - Your("%s %s.", aobjnam(uwep, "faintly glow"), color); + pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color); return(1); } /* there is a (soft) upper and lower limit to uwep->spe */ if(((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0)) && rn2(3)) { if (!Blind) - Your("%s %s for a while and then %s.", - aobjnam(uwep, "violently glow"), color, + pline("%s %s for a while and then %s.", + Yobjnam2(uwep, "violently glow"), color, otense(uwep, "evaporate")); else - Your("%s.", aobjnam(uwep, "evaporate")); + pline("%s.", Yobjnam2(uwep, "evaporate")); useupall(uwep); /* let all of them disappear */ return(1); } if (!Blind) { xtime = (amount*amount == 1) ? "moment" : "while"; - Your("%s %s for a %s.", - aobjnam(uwep, amount == 0 ? "violently glow" : "glow"), - color, xtime); + pline("%s %s for a %s.", + Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), + color, xtime); if (otyp != STRANGE_OBJECT && uwep->known && (amount > 0 || (amount < 0 && otmp->bknown))) makeknown(otyp); @@ -773,8 +748,7 @@ register int amount; /* elven weapons vibrate warningly when enchanted beyond a limit */ if ((uwep->spe > 5) && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7))) - Your("%s unexpectedly.", - aobjnam(uwep, "suddenly vibrate")); + pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate")); return(1); } @@ -797,8 +771,8 @@ register struct obj *obj; long savewornmask; savewornmask = obj->owornmask; - Your("%s %s welded to your %s!", - xname(obj), otense(obj, "are"), + pline("%s welded to your %s!", + Yobjnam2(obj, "are"), bimanual(obj) ? (const char *)makeplural(body_part(HAND)) : body_part(HAND)); obj->owornmask = savewornmask; diff --git a/src/zap.c b/src/zap.c index 838f555ed..6f50d58b1 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1959,7 +1959,7 @@ boolean ordinary; if (BInvis && uarmc->otyp == MUMMY_WRAPPING) { /* A mummy wrapping absorbs it and protects you */ - You_feel("rather itchy under your %s.", xname(uarmc)); + You_feel("rather itchy under %s.", yname(uarmc)); break; } if (ordinary || !rn2(10)) { /* permanent */ @@ -3980,8 +3980,7 @@ int osym, dmgtyp; if(!rn2(3)) cnt++; if(!cnt) continue; - if (vis) pline("%s %s %s!", - s_suffix(Monnam(mtmp)), xname(obj), + if (vis) pline("%s %s!", yname(obj), (cnt > 1L) ? destroy_strings[dindx*3 + 1] : destroy_strings[dindx*3]); for(i = 0; i < cnt; i++) m_useup(mtmp, obj);