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:
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() */
|
||||
|
||||
Reference in New Issue
Block a user