MCPcopy Create free account
hub / github.com/NetHack/NetHack / ansimpleoname

Function ansimpleoname

src/objnam.c:2445–2470  ·  view source on GitHub ↗

"a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */

Source from the content-addressed store, hash-verified

2443
2444/* "a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */
2445char *
2446ansimpleoname(struct obj *obj)
2447{
2448 char *obufp, *simpleoname = simpleonames(obj);
2449 int otyp = obj->otyp;
2450
2451 /* prefix with "the" if a unique item, or a fake one imitating same,
2452 has been formatted with its actual name (we let minimal_xname() handle
2453 any `known' and `dknown' checking necessary) */
2454 if (otyp == FAKE_AMULET_OF_YENDOR)
2455 otyp = AMULET_OF_YENDOR;
2456 if (objects[otyp].oc_unique && OBJ_NAME(objects[otyp])
2457 && !strcmp(simpleoname, OBJ_NAME(objects[otyp]))) {
2458 /* the() will allocate another obuf[]; we want to avoid using two */
2459 obufp = the(simpleoname);
2460 Strcpy(simpleoname, obufp);
2461 releaseobuf(obufp);
2462 } else if (obj->quan == 1L) {
2463 /* simpleoname[] is singular if quan==1, plural otherwise;
2464 an() will allocate another obuf[]; we want to avoid using two */
2465 obufp = an(simpleoname);
2466 Strcpy(simpleoname, obufp);
2467 releaseobuf(obufp);
2468 }
2469 return simpleoname;
2470}
2471
2472/* "the scroll" or "the scrolls" */
2473char *

Callers 15

onameFunction · 0.85
accessory_or_armor_onFunction · 0.85
domove_fight_emptyFunction · 0.85
gcrownuFunction · 0.85
give_spellFunction · 0.85
bestow_artifactFunction · 0.85
pick_lockFunction · 0.85
safeq_shortxprnameFunction · 0.85
cinv_ansimpleonameFunction · 0.85
hideunderFunction · 0.85
lightdamageFunction · 0.85
muse_unslimeFunction · 0.85

Calls 4

simpleonamesFunction · 0.85
theFunction · 0.85
releaseobufFunction · 0.85
anFunction · 0.85

Tested by

no test coverage detected