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

Function silly_thing

src/invent.c:2091–2131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2089}
2090
2091DISABLE_WARNING_FORMAT_NONLITERAL
2092
2093void
2094silly_thing(const char *word,
2095 struct obj *otmp)
2096{
2097#ifdef OBSOLETE_HANDLING
2098 /* 'P','R' vs 'W','T' handling is obsolete */
2099 const char *s1, *s2, *s3;
2100 int ocls = otmp->oclass, otyp = otmp->otyp;
2101
2102 s1 = s2 = s3 = 0;
2103 /* check for attempted use of accessory commands ('P','R') on armor
2104 and for corresponding armor commands ('W','T') on accessories */
2105 if (ocls == ARMOR_CLASS) {
2106 if (!strcmp(word, "put on"))
2107 s1 = "W", s2 = "wear", s3 = "";
2108 else if (!strcmp(word, "remove"))
2109 s1 = "T", s2 = "take", s3 = " off";
2110 } else if ((ocls == RING_CLASS || otyp == MEAT_RING)
2111 || ocls == AMULET_CLASS
2112 || (otyp == BLINDFOLD || otyp == TOWEL || otyp == LENSES)) {
2113 if (!strcmp(word, "wear"))
2114 s1 = "P", s2 = "put", s3 = " on";
2115 else if (!strcmp(word, "take off"))
2116 s1 = "R", s2 = "remove", s3 = "";
2117 }
2118 if (s1)
2119 pline("Use the '%s' command to %s %s%s.", s1, s2,
2120 !(is_plural(otmp) || pair_of(otmp)) ? "that" : "those", s3);
2121 else
2122#endif
2123 /* see comment about Amulet of Yendor in objtyp_is_callable(do_name.c);
2124 known fakes yield the silly thing feedback */
2125 if (!strcmp(word, "call")
2126 && (otmp->otyp == AMULET_OF_YENDOR
2127 || (otmp->otyp == FAKE_AMULET_OF_YENDOR && !otmp->known)))
2128 pline_The("Amulet doesn't like being called names.");
2129 else
2130 pline(silly_thing_to, word);
2131}
2132
2133RESTORE_WARNING_FORMAT_NONLITERAL
2134

Callers 2

canwearobjFunction · 0.85
getobjFunction · 0.85

Calls 2

pline_TheFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected