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

Function bogusmon

src/do_name.c:1368–1385  ·  view source on GitHub ↗

fake monsters used to be in a hard-coded array, now in a data file */

Source from the content-addressed store, hash-verified

1366
1367/* fake monsters used to be in a hard-coded array, now in a data file */
1368char *
1369bogusmon(char *buf, char *code)
1370{
1371 char *mnam = buf;
1372
1373 if (code)
1374 *code = '\0';
1375 /* might fail (return empty buf[]) if the file isn't available */
1376 get_rnd_text(BOGUSMONFILE, buf, rn2_on_display_rng, MD_PAD_BOGONS);
1377 if (!*mnam) {
1378 Strcpy(buf, "bogon");
1379 } else if (strchr(bogon_codes, *mnam)) { /* strip prefix if present */
1380 if (code)
1381 *code = *mnam;
1382 ++mnam;
1383 }
1384 return mnam;
1385}
1386
1387/* return a random monster name, for hallucination */
1388char *

Callers 3

namefloorobjFunction · 0.85
rndmonnamFunction · 0.85
mcast_insectsFunction · 0.85

Calls 1

get_rnd_textFunction · 0.85

Tested by

no test coverage detected