for debugging messages, where data might be suspect and we aren't taking what the hero does or doesn't know into consideration */
| 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 */ |
| 1253 | char * |
| 1254 | minimal_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 |
| 1288 | int |