MCPcopy Index your code
hub / github.com/NetHack/NetHack / yname

Function yname

src/objnam.c:2358–2374  ·  view source on GitHub ↗

returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */

Source from the content-addressed store, hash-verified

2356
2357/* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */
2358char *
2359yname(struct obj *obj)
2360{
2361 char *s = cxname(obj);
2362
2363 /* leave off "your" for most of your artifacts, but prepend
2364 * "your" for unique objects and "foo of bar" quest artifacts */
2365 if (!carried(obj) || !obj_is_pname(obj)
2366 || obj->oartifact >= ART_ORB_OF_DETECTION) {
2367 char *outbuf = shk_your(nextobuf(), obj);
2368 int space_left = BUFSZ - 1 - Strlen(outbuf);
2369
2370 s = strncat(outbuf, s, space_left);
2371 }
2372
2373 return s;
2374}
2375
2376/* capitalized variant of yname() */
2377char *

Callers 15

wield_toolFunction · 0.85
stealFunction · 0.85
maybe_absorb_itemFunction · 0.85
peffect_invisibilityFunction · 0.85
potion_dipFunction · 0.85
inaccessible_equipmentFunction · 0.85
do_attackFunction · 0.85
hmon_hitmon_splitmonFunction · 0.85
litterFunction · 0.85
dosinkringFunction · 0.85
revive_corpseFunction · 0.85

Calls 4

cxnameFunction · 0.85
obj_is_pnameFunction · 0.85
shk_yourFunction · 0.85
nextobufFunction · 0.85

Tested by

no test coverage detected