fix more your corpse cases
- new cxname() to simplify doing the right thing in increasingly common cases - use for bullwhip snagging - in shopkeeper offer code - in a couple other existing places rather than duplicating CORPSE checks - use singular(...) in "swings" cases, since only one can hit. Singular uses corpse_xname automatically when appropriate
This commit is contained in:
@@ -1316,6 +1316,7 @@ E boolean FDECL(the_unique_obj, (struct obj *obj));
|
||||
E char *FDECL(doname, (struct obj *));
|
||||
E boolean FDECL(not_fully_identified, (struct obj *));
|
||||
E char *FDECL(corpse_xname, (struct obj *,BOOLEAN_P));
|
||||
E char *FDECL(cxname, (struct obj *));
|
||||
E const char *FDECL(singular, (struct obj *,char *(*)(OBJ_P)));
|
||||
E char *FDECL(an, (const char *));
|
||||
E char *FDECL(An, (const char *));
|
||||
|
||||
@@ -2163,7 +2163,7 @@ struct obj *obj;
|
||||
const char *mon_hand;
|
||||
boolean gotit = proficient && (!Fumbling || !rn2(10));
|
||||
|
||||
Strcpy(onambuf, xname(otmp));
|
||||
Strcpy(onambuf, cxname(otmp));
|
||||
if (gotit) {
|
||||
mon_hand = mbodypart(mtmp, HAND);
|
||||
if (bimanual(otmp)) mon_hand = makeplural(mon_hand);
|
||||
|
||||
@@ -1188,7 +1188,7 @@ register struct obj *otemp;
|
||||
Strcpy(buf, mon_nam(mdef));
|
||||
pline("%s %s %s %s at %s.", Monnam(magr),
|
||||
(objects[otemp->otyp].oc_dir & PIERCE) ? "thrusts" : "swings",
|
||||
mhis(magr), xname(otemp), buf);
|
||||
mhis(magr), singular(otemp, xname), buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -111,7 +111,7 @@ register struct obj *otemp;
|
||||
return;
|
||||
pline("%s %s %s %s.", Monnam(mtmp),
|
||||
(objects[otemp->otyp].oc_dir & PIERCE) ? "thrusts" : "swings",
|
||||
mhis(mtmp), xname(otemp));
|
||||
mhis(mtmp), singular(otemp, xname));
|
||||
}
|
||||
|
||||
/* return how a poison attack was delivered */
|
||||
|
||||
15
src/objnam.c
15
src/objnam.c
@@ -824,6 +824,16 @@ boolean ignore_oquan; /* to force singular */
|
||||
return makeplural(nambuf);
|
||||
}
|
||||
|
||||
/* xname, unless it's a corpse, then corpse_xname(obj, FALSE) */
|
||||
char *
|
||||
cxname(obj)
|
||||
struct obj *obj;
|
||||
{
|
||||
if (obj->otyp == CORPSE)
|
||||
return corpse_xname(obj, FALSE);
|
||||
return xname(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Used if only one of a collection of objects is named (e.g. in eat.c).
|
||||
*/
|
||||
@@ -1092,10 +1102,7 @@ struct obj *obj;
|
||||
char *s = shk_your(outbuf, obj); /* assert( s == outbuf ); */
|
||||
int space_left = BUFSZ - strlen(s) - sizeof " ";
|
||||
|
||||
/* "your corpse" is silly, use corpse_xname for this case */
|
||||
return strncat(strcat(s, " "),
|
||||
(obj->otyp == CORPSE) ?
|
||||
corpse_xname(obj, FALSE) : xname(obj), space_left);
|
||||
return strncat(strcat(s, " "), cxname(obj), space_left);
|
||||
}
|
||||
|
||||
/* capitalized variant of yname() */
|
||||
|
||||
@@ -2685,7 +2685,7 @@ move_on:
|
||||
offer, plur(offer),
|
||||
(!ltmp && cltmp && only_partially_your_contents) ?
|
||||
" your items in" : (!ltmp && cltmp) ? " the contents of" : "",
|
||||
obj->unpaid ? "the" : "your", xname(obj),
|
||||
obj->unpaid ? "the" : "your", cxname(obj),
|
||||
(obj->quan == 1L &&
|
||||
!(!ltmp && cltmp && only_partially_your_contents)) ?
|
||||
"it" : "them");
|
||||
|
||||
@@ -310,8 +310,7 @@ gotobj:
|
||||
pline("%s tries to %s your %s but gives up.",
|
||||
Monnam(mtmp), how[rn2(SIZE(how))],
|
||||
(otmp->owornmask & W_ARMOR) ? equipname(otmp) :
|
||||
(otmp->otyp == CORPSE) ? corpse_xname(otmp, FALSE) :
|
||||
xname(otmp));
|
||||
cxname(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) */
|
||||
|
||||
Reference in New Issue
Block a user