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

Function monverbself

src/do_name.c:1220–1249  ·  view source on GitHub ↗

construct " {him|her|it}self" which might be distorted by Hallu; if that's plural, adjust monnamtext and verb */

Source from the content-addressed store, hash-verified

1218/* construct "<monnamtext> <verb> <othertext> {him|her|it}self" which might
1219 be distorted by Hallu; if that's plural, adjust monnamtext and verb */
1220char *
1221monverbself(
1222 struct monst *mon,
1223 char *monnamtext, /* modifiable 'mbuf' with adequate room at end */
1224 const char *verb,
1225 const char *othertext)
1226{
1227 char *verbs, selfbuf[40]; /* sizeof "themselves" suffices */
1228
1229 /* "himself"/"herself"/"itself", maybe "themselves" if hallucinating */
1230 Strcpy(selfbuf, mon_nam_too(mon, mon));
1231 /* verb starts plural; this will yield singular except for "themselves" */
1232 verbs = vtense(selfbuf, verb);
1233 if (!strcmp(verb, verbs)) { /* a match indicates that it stayed plural */
1234 monnamtext = makeplural(monnamtext);
1235 /* for "it", makeplural() produces "them" but we want "they" */
1236 if (!strcmpi(monnamtext, genders[3].he)) {
1237 boolean capitaliz = (monnamtext[0] == highc(monnamtext[0]));
1238
1239 Strcpy(monnamtext, genders[3].him);
1240 if (capitaliz)
1241 monnamtext[0] = highc(monnamtext[0]);
1242 }
1243 }
1244 Strcat(strcat(monnamtext, " "), verbs);
1245 if (othertext && *othertext)
1246 Strcat(strcat(monnamtext, " "), othertext);
1247 Strcat(strcat(monnamtext, " "), selfbuf);
1248 return monnamtext;
1249}
1250
1251/* for debugging messages, where data might be suspect and we aren't
1252 taking what the hero does or doesn't know into consideration */

Callers 5

kick_steedFunction · 0.85
mzapwandFunction · 0.85
mplayhornFunction · 0.85
muse_unslimeFunction · 0.85
use_mirrorFunction · 0.85

Calls 4

mon_nam_tooFunction · 0.85
vtenseFunction · 0.85
makepluralFunction · 0.85
highcFunction · 0.85

Tested by

no test coverage detected