]> granicus.if.org Git - nethack/commitdiff
"your" artifacts
authorcohrs <cohrs>
Thu, 18 Sep 2003 02:52:40 +0000 (02:52 +0000)
committercohrs <cohrs>
Thu, 18 Sep 2003 02:52:40 +0000 (02:52 +0000)
This patch introduces a change to yname() and Yname2() that avoids the
possessive "your" for the hero's normal, fully identified artifacts.
Quest artifacts still get the possessive, as do all other objects and all
objects not in the hero's possession.  shk_your()/Shk_Your() are used in
many places with a specific, generalized name for the object, so I didn't
introduce the artifact behavior there, although I did change them to append
a space, which simplified some other code.  Through added use of yname(),
there may be some places that used to just say "corpse" that will now be more
descriptive via yname()'s use of cxname().  I'm sure <Someone> will point
out any such places that are too onerous, although nothing obviously is.

I took the opportunity to inspect many uses of "your" and even Your().  Two
new functions are also introduced, yobjnam() and Yobjnam2(), which work
like aobjnam() and yname() combined, because I found that many uses of
aobjnam() were preceeded by "your" and I couldn't generally provide the
desired behavior for artifacts (or future artifacts) without a combined
function.  In some cases, this change allowed better sharing of code.

rust_dmg() still takes a string as input which is sometimes initialized
from xname() and often prepends "your" to it.  Currently, this isn't a
problem since there currently are no normal, armor artifacts.  If/when any
are introduced, rust_dmg() will need to be addressed.

The patch is for the trunk only.  A lot of research was required and I
didn't feel the upside was there for repeating it in the 3.4.3 branch.

28 files changed:
include/extern.h
src/apply.c
src/ball.c
src/dig.c
src/do.c
src/dothrow.c
src/eat.c
src/engrave.c
src/lock.c
src/mhitm.c
src/mhitu.c
src/mon.c
src/muse.c
src/objnam.c
src/pickup.c
src/polyself.c
src/potion.c
src/pray.c
src/read.c
src/shk.c
src/sit.c
src/steal.c
src/timeout.c
src/trap.c
src/uhitm.c
src/weapon.c
src/wield.c
src/zap.c

index 7b518d07ad0de3b4f1715b4dca71dfdf811622c2..4fb9397a35ce52abee355e4bcefcd838761d4b8c 100644 (file)
@@ -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 *));
index f3f9d881c3e91ec60c79cd742fca012828b2022a..2f7eecfd8ed732fc6639ee413df5c4d37ae56dd0 100644 (file)
@@ -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);
index 8cc7b473cc95a08c9841e624d44e505e2cd0b905..d4eaa6cf3c0657fd8f2e0e644f1888dc394b06f0 100644 (file)
@@ -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);
                        }
                }
index dff8a766d56604ca4053ebd92091fb1f4aeefdf9..05b273a8976b8cb77fe01933e1cc789fedd7d105 100644 (file)
--- 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 ||
index 7902db7a9bfbe91ae8e962bba1b7d7dbcadf434e..82bc87aab81da9301a3deaae4b8d644faf8f7c3d 100644 (file)
--- 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)));
index 0900c9e1ae0484223fddcd93fe44e8cdb376d99e..0abc0bba946c45438914626d5620587993edf1f3 100644 (file)
@@ -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))) {
index 6b748c3ccb6ae2cea4c575b634e3d12e812cc5c2..b42b4dea617db2548b9643978deed873028e0b39 100644 (file)
--- 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.");
index d79f7876ae9aa93d73eab57be5ea653995d6d61a..eefc45fe89bf2b671b3004696144340bf0f4ed6b 100644 (file)
@@ -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) {
index 5ceabde2b06142100a53e2f59c3181142faf2732..a1cc8c6628e37e246f21487f417c94360f39e09f 100644 (file)
@@ -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;
index 0a3e9ef100046bee46ef9e7b2c8ac0d5bef1fcf8..9f9b3d99d365c6914780b9098862d941262457c9 100644 (file)
@@ -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" : "");
                    }
index 4939a2169d8301a3589c1b279628b2b84c3279ee..6e551f1f5956e178f8610c0a03b07d47b80e3c28 100644 (file)
@@ -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");
index d0a1794fdc26b07afb027061f1fb04b4b13a6b65..b58aeb29ce9baa4526453ef96e51713e23cd4848 100644 (file)
--- 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;
        }
index ed8b560287f87e2a86e8273f84f5466def3fddeb..7e92ad71b77e45a0343f2cb5654286b8b6a24c3b 100644 (file)
@@ -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
index 5dadeb7e9a4f3c4c3e0e5bce3b11c1bb66ee78f3..0b5f5e0147820b456212d2fde84e113e0b07d178 100644 (file)
@@ -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);
+
+       /* 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);
 
-       return strncat(strcat(s, " "), cxname(obj), space_left);
+           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() */
index ef4d5eb621198df678bf55c71f05e5104421be09..6c2529858bab83d53c0612ac840a6efb8209240d 100644 (file)
@@ -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)) {
index 75dd37875da89963c9b8567b1adab7094f86959d..ff4babac4b167c31607fdf788417c346035b8b1d 100644 (file)
@@ -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));
index 1ad5abe2f4efd2693696b2d833dac9b01a0306dc..743cf50a9ad2a1735339a0bf1824712adca389c5 100644 (file)
@@ -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) {
index 084f6d702a6d691585236217eb872c3eda0be867..db14672f7d67c48ecbd53a156495e1b25dccf53a 100644 (file)
@@ -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;
                    }
index c0ca11c1174029272f8461706054070c74897085..39478675299bc363cc522e5e0a019b5550776bb9 100644 (file)
@@ -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);
index acef77df53e1284de60a4e1290c9666e7a9bfe60..15c7f2acfee279c976856abe144a39521c2a7e4f 100644 (file)
--- 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;
 }
 
index deb1c110c8c6738e566a08d29e33e9f67f87440a..150b90d1f7be9ceb2a71e78c2a933434c50514d2 100644 (file)
--- 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;
            }
index f03e3d808599671467ae96442dc39937cbcf9978..b59483d68aa96838784c517f442ee9ff44479d46 100644 (file)
@@ -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) */
index 832815a4d44f4d4b46563295860d7c7d50caacb6..3a70b92770354baaf39496da05617317da3d8147 100644 (file)
@@ -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:
index 5b93573c91d0b988a536d5a9852c65522dc7adf1..429c2c045b05ae963b0f30653586fdb7a7f22704 100644 (file)
@@ -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);
     }
index 9614311c07f0f405d0ea0242463252efd26a5376..6325121ba5263f1204ed847e17921a3aea2df1a0 100644 (file)
@@ -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;
            }
index a3e4407d4b8262f86125a4123db2ac00d436196e..44c8c82f8e6e0e187d034f2e06751ae7aef0f588 100644 (file)
@@ -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;
                    }
index d261960d6cd5df8fbb80db5233680adb2691ef4d..7b2028574ab79501389052f5b36e24a14d219808 100644 (file)
@@ -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"),
-                       acid_dmg ? "corroded" : "rusty");
-               else if (vismon)
-                   pline("%s's %s completely %s.", Monnam(victim),
-                       aobjnam(target, "look"),
+                   pline("%s completely %s.",
+                       Yobjnam2(target, Blind ? "feel" : "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;
index 838f555edb8d0de660be5258a7fa745729cf56ae..6f50d58b167e3716ea491dd14b82d9ca2635b6e2 100644 (file)
--- 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);