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

Function item_naming_classification

src/iactions.c:45–82  ·  view source on GitHub ↗

construct text for the menu entries for IA_NAME_OBJ and IA_NAME_OTYP */

Source from the content-addressed store, hash-verified

43
44/* construct text for the menu entries for IA_NAME_OBJ and IA_NAME_OTYP */
45staticfn boolean
46item_naming_classification(
47 struct obj *obj,
48 char *onamebuf,
49 char *ocallbuf)
50{
51 static const char
52 Name[] = "Name",
53 Rename[] = "Rename or un-name",
54 Call[] = "Call",
55 /* "re-call" seems a bit weird, but "recall" and
56 "rename" don't fit for changing a type name */
57 Recall[] = "Re-call or un-call";
58
59 onamebuf[0] = ocallbuf[0] = '\0';
60 if (name_ok(obj) == GETOBJ_SUGGEST) {
61 Sprintf(onamebuf, "%s %s %s",
62 (!has_oname(obj) || !*ONAME(obj)) ? Name : Rename,
63 the_unique_obj(obj) ? "the"
64 : !is_plural(obj) ? "this specific"
65 : "this stack of", /*"these",*/
66 simpleonames(obj));
67 }
68 if (call_ok(obj) == GETOBJ_SUGGEST) {
69 char *callname = simpleonames(obj);
70
71 /* prefix known unique item with "the", make all other types plural */
72 if (the_unique_obj(obj)) /* treats unID'd fake amulets as if real */
73 callname = the(callname);
74 else if (!is_plural(obj))
75 callname = makeplural(callname);
76 Sprintf(ocallbuf, "%s the type for %s",
77 (!objects[obj->otyp].oc_uname
78 || !*objects[obj->otyp].oc_uname) ? Call : Recall,
79 callname);
80 }
81 return (*onamebuf || *ocallbuf) ? TRUE : FALSE;
82}
83
84/* construct text for the menu entries for IA_READ_OBJ */
85staticfn int

Callers 1

itemactionsFunction · 0.85

Calls 6

name_okFunction · 0.85
the_unique_objFunction · 0.85
simpleonamesFunction · 0.85
call_okFunction · 0.85
theFunction · 0.85
makepluralFunction · 0.85

Tested by

no test coverage detected