fix github issue #531 - genderless corpses

Dead monsters that had traits saved with the corpse would revive as
the same gender, but ordinary corpses revived with random gender so
could be different from before they got killed.

Since corpses of monsters lacked gender, those for monsters with
gender-specific names were described by the neuter name.

This is a fairly big change for a fairly minor problem and needs a
lot more testing.

Fixes #531
This commit is contained in:
PatR
2021-06-08 03:43:46 -07:00
parent 14b2330fd6
commit 04a8ddcce1
12 changed files with 121 additions and 66 deletions

View File

@@ -603,7 +603,7 @@ animate_statue(
struct obj *item;
coord cc;
boolean historic = (Role_if(PM_ARCHEOLOGIST)
&& (statue->spe & STATUE_HISTORIC) != 0),
&& (statue->spe & CORPSTAT_HISTORIC) != 0),
golem_xform = FALSE, use_saved_traits;
const char *comes_to_life;
char statuename[BUFSZ], tmpbuf[BUFSZ];
@@ -645,10 +645,16 @@ animate_statue(
be NON_PM; otherwise, set form to match the statue */
if (mon && mon->cham >= LOW_PM)
(void) newcham(mon, mptr, FALSE, FALSE);
} else
} else {
mon = makemon(mptr, x, y, (cause == ANIMATE_SPELL)
? (NO_MINVENT | MM_ADJACENTOK)
: NO_MINVENT);
}
/* a non-montraits() statue might specify gender */
if ((statue->spe & CORPSTAT_MALE) != 0)
mon->female = 0;
else if ((statue->spe & CORPSTAT_FEMALE) != 0)
mon->female = 1;
}
if (!mon) {
@@ -659,11 +665,6 @@ animate_statue(
return (struct monst *) 0;
}
/* a non-montraits() statue might specify gender */
if (statue->spe & STATUE_MALE)
mon->female = FALSE;
else if (statue->spe & STATUE_FEMALE)
mon->female = TRUE;
/* if statue has been named, give same name to the monster */
if (has_oname(statue) && !unique_corpstat(mon->data))
mon = christen_monst(mon, ONAME(statue));