mons[]->pmname for a corpse or statue or figurine */
| 1318 | |
| 1319 | /* mons[]->pmname for a corpse or statue or figurine */ |
| 1320 | const char * |
| 1321 | obj_pmname(struct obj *obj) |
| 1322 | { |
| 1323 | #if 0 /* ignore saved montraits even when they're available; they determine |
| 1324 | * what a corpse would revive as if resurrected (human corpse from |
| 1325 | * slain vampire revives as vampire rather than as human, for example) |
| 1326 | * and don't necessarily reflect the state of the corpse itself */ |
| 1327 | if (has_omonst(obj)) { |
| 1328 | struct monst *m = OMONST(obj); |
| 1329 | |
| 1330 | /* obj->oextra->omonst->data is Null but ...->mnum is set */ |
| 1331 | if (ismnum(m->mnum)) |
| 1332 | return pmname(&mons[m->mnum], Mgender(m)); |
| 1333 | } |
| 1334 | #endif |
| 1335 | if ((obj->otyp == CORPSE || obj->otyp == STATUE || obj->otyp == FIGURINE) |
| 1336 | && ismnum(obj->corpsenm)) { |
| 1337 | int cgend = (obj->spe & CORPSTAT_GENDER), |
| 1338 | mgend = ((cgend == CORPSTAT_MALE) ? MALE |
| 1339 | : (cgend == CORPSTAT_FEMALE) ? FEMALE |
| 1340 | : NEUTRAL), |
| 1341 | mndx = obj->corpsenm; |
| 1342 | |
| 1343 | /* mons[].pmnames[] for monster cleric uses "priest" or "priestess" |
| 1344 | or "aligned cleric"; we want to avoid "aligned cleric [corpse]" |
| 1345 | unless it has been explicitly flagged as neuter rather than |
| 1346 | defaulting to random (which fails male or female check above); |
| 1347 | role monster cleric uses "priest" or "priestess" or "cleric" |
| 1348 | without "aligned" prefix so we switch to that; [can't force |
| 1349 | random gender to be chosen here because splitting a stack of |
| 1350 | corpses could cause the split-off portion to change gender, so |
| 1351 | settle for avoiding "aligned"] */ |
| 1352 | if (mndx == PM_ALIGNED_CLERIC && cgend == CORPSTAT_RANDOM) |
| 1353 | mndx = PM_CLERIC; |
| 1354 | |
| 1355 | return pmname(&mons[mndx], mgend); |
| 1356 | } |
| 1357 | impossible("obj_pmname otyp:%i,corpsenm:%i", obj->otyp, obj->corpsenm); |
| 1358 | return "two-legged glorkum-seeker"; |
| 1359 | } |
| 1360 | |
| 1361 | /* used by bogusmon(next) and also by init_CapMons(rumors.c); |
| 1362 | bogon_is_pname(below) checks a hard-coded subset of these rather than |
no test coverage detected