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

Function on_msg

src/do_wear.c:75–99  ·  view source on GitHub ↗

for items that involve no delay */

Source from the content-addressed store, hash-verified

73
74/* for items that involve no delay */
75staticfn void
76on_msg(struct obj *otmp)
77{
78 /* on_msg() for rings and amulets just shows add-to-invent feedback
79 [after caller calls setworn(), for suffix: "(on {left|right} hand)"
80 or "(being worn)"]; eyewear too unless giving verbose message below */
81 if ((otmp->owornmask & (W_RING | W_AMUL)) != 0L
82 || ((otmp->owornmask & W_TOOL) != 0L && !flags.verbose)) {
83 prinv((char *) NULL, otmp, 0L);
84 return;
85 }
86
87 if (flags.verbose) {
88 char how[BUFSZ];
89 /* call xname() before obj_is_pname(); formatting obj's name
90 might set obj->dknown and that affects the pname test */
91 const char *otmp_name = xname(otmp);
92
93 how[0] = '\0';
94 if (otmp->otyp == TOWEL)
95 Sprintf(how, " around your %s", body_part(HEAD));
96 You("are now wearing %s%s.",
97 obj_is_pname(otmp) ? the(otmp_name) : an(otmp_name), how);
98 }
99}
100
101/* putting on or taking off an item which confers stealth;
102 give feedback and discover it iff stealth state is changing;

Callers 3

Amulet_onFunction · 0.85
Blindf_onFunction · 0.85
accessory_or_armor_onFunction · 0.85

Calls 7

prinvFunction · 0.85
xnameFunction · 0.85
body_partFunction · 0.85
YouFunction · 0.85
obj_is_pnameFunction · 0.85
theFunction · 0.85
anFunction · 0.85

Tested by

no test coverage detected