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

Function cinv_ansimpleoname

src/invent.c:5422–5441  ·  view source on GitHub ↗

used by safe_qbuf() if the full doname() result is too long */

Source from the content-addressed store, hash-verified

5420
5421/* used by safe_qbuf() if the full doname() result is too long */
5422staticfn char *
5423cinv_ansimpleoname(struct obj *obj)
5424{
5425 char *result = ansimpleoname(obj);
5426
5427 /* result is an obuf[] so we know this will always fit */
5428 if (obj->otrapped) {
5429 if (strncmp(result, "a ", 2))
5430 (void) strsubst(result, "a ", "a trapped ");
5431 else if (strncmp(result, "an ", 3))
5432 (void) strsubst(result, "an ", "an trapped ");
5433 /* unique container? nethack doesn't have any */
5434 else if (strncmp(result, "the ", 4))
5435 (void) strsubst(result, "the ", "the trapped ");
5436 /* no leading article at all? shouldn't happen with ansimpleoname() */
5437 else
5438 (void) strsubst(result, "", "trapped "); /* insert at beginning */
5439 }
5440 return result;
5441}
5442
5443/* Display the contents of a container in inventory style.
5444 Used for wand of probing of non-empty containers and statues. */

Callers

nothing calls this directly

Calls 2

ansimpleonameFunction · 0.85
strsubstFunction · 0.85

Tested by

no test coverage detected