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

Function singular

src/objnam.c:2090–2105  ·  view source on GitHub ↗

* Used if only one of a collection of objects is named (e.g. in eat.c). */

Source from the content-addressed store, hash-verified

2088 * Used if only one of a collection of objects is named (e.g. in eat.c).
2089 */
2090const char *
2091singular(struct obj *otmp, char *(*func)(OBJ_P))
2092{
2093 long savequan;
2094 char *nam;
2095
2096 /* using xname for corpses does not give the monster type */
2097 if (otmp->otyp == CORPSE && func == xname)
2098 func = cxname;
2099
2100 savequan = otmp->quan;
2101 otmp->quan = 1L;
2102 nam = (*func)(otmp);
2103 otmp->quan = savequan;
2104 return nam;
2105}
2106
2107/* pick "", "a ", or "an " as article for 'str'; used by an() and doname() */
2108char *

Callers 15

hmon_hitmon_misc_objFunction · 0.85
throw_objFunction · 0.85
chest_shatter_msgFunction · 0.85
food_xnameFunction · 0.85
fprefxFunction · 0.85
doeat_nonfoodFunction · 0.85
really_kick_objectFunction · 0.85
mreadmsgFunction · 0.85
mquaffmsgFunction · 0.85
use_offensiveFunction · 0.85
monshootFunction · 0.85
use_whipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected