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

Function minimal_monnam

src/do_name.c:1253–1285  ·  view source on GitHub ↗

for debugging messages, where data might be suspect and we aren't taking what the hero does or doesn't know into consideration */

Source from the content-addressed store, hash-verified

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 */
1253char *
1254minimal_monnam(struct monst *mon, boolean ckloc)
1255{
1256 struct permonst *ptr;
1257 char *outbuf = nextmbuf();
1258
1259 if (!mon) {
1260 Strcpy(outbuf, "[Null monster]");
1261 } else if ((ptr = mon->data) == 0) {
1262 Strcpy(outbuf, "[Null mon->data]");
1263 } else if (ptr < &mons[0]) {
1264 Sprintf(outbuf, "[Invalid mon->data %s < %s]",
1265 fmt_ptr((genericptr_t) mon->data),
1266 fmt_ptr((genericptr_t) &mons[0]));
1267 } else if (ptr >= &mons[NUMMONS]) {
1268 Sprintf(outbuf, "[Invalid mon->data %s >= %s]",
1269 fmt_ptr((genericptr_t) mon->data),
1270 fmt_ptr((genericptr_t) &mons[NUMMONS]));
1271 } else if (ckloc && ptr == &mons[PM_LONG_WORM] && mon->mx
1272 && svl.level.monsters[mon->mx][mon->my] != mon) {
1273 Sprintf(outbuf, "%s <%d,%d>",
1274 pmname(&mons[PM_LONG_WORM_TAIL], Mgender(mon)),
1275 mon->mx, mon->my);
1276 } else {
1277 Sprintf(outbuf, "%s%s <%d,%d>",
1278 mon->mtame ? "tame " : mon->mpeaceful ? "peaceful " : "",
1279 mon_pmname(mon), mon->mx, mon->my);
1280 if (mon->cham != NON_PM)
1281 Sprintf(eos(outbuf), "{%s}",
1282 pmname(&mons[mon->cham], Mgender(mon)));
1283 }
1284 return outbuf;
1285}
1286
1287#ifndef PMNAME_MACROS
1288int

Callers 3

place_monsterFunction · 0.85
list_migrating_monsFunction · 0.85
m_detachFunction · 0.85

Calls 6

nextmbufFunction · 0.85
fmt_ptrFunction · 0.85
pmnameFunction · 0.85
MgenderFunction · 0.85
mon_pmnameFunction · 0.85
eosFunction · 0.85

Tested by

no test coverage detected