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:
cohrs
2002-02-27 05:15:48 +00:00
parent c9f7360301
commit 8fb7664869
7 changed files with 17 additions and 10 deletions

View File

@@ -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() */