E void FDECL(hide_monst, (struct monst *));
E void FDECL(mon_animal_list, (BOOLEAN_P));
E int FDECL(select_newcham_form, (struct monst *));
+E void FDECL(mgender_from_permonts, (struct monst *, struct permonst *));
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
E int FDECL(can_be_hatched, (int));
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
return polyok(mdat) ? mdat : 0;
}
+void
+mgender_from_permonst(mtmp, mdat)
+struct monst *mtmp;
+struct permonst *mdat;
+{
+ if(is_male(mdat)) {
+ if(mtmp->female) mtmp->female = FALSE;
+ } else if (is_female(mdat)) {
+ if(!mtmp->female) mtmp->female = TRUE;
+ } else if (!is_neuter(mdat)) {
+ if(!rn2(10)) mtmp->female = !mtmp->female;
+ }
+}
+
/* make a chameleon take on another shape, or a polymorph target
(possibly self-infliced) become a different monster;
returns 1 if it actually changes form */
} else if (mvitals[monsndx(mdat)].mvflags & G_GENOD)
return(0); /* passed in mdat is genocided */
- if(is_male(mdat)) {
- if(mtmp->female) mtmp->female = FALSE;
- } else if (is_female(mdat)) {
- if(!mtmp->female) mtmp->female = TRUE;
- } else if (!is_neuter(mdat)) {
- if(!rn2(10)) mtmp->female = !mtmp->female;
- }
+ mgender_from_permonst(mtmp, mdat);
if (In_endgame(&u.uz) && is_mplayer(olddata) && has_mname(mtmp)) {
/* mplayers start out as "Foo the Bar", but some of the
if ((mndx != NON_PM) && (&mons[mndx] != mtmp->data)) {
struct permonst *mdat = &mons[mndx];
struct permonst *olddata = mtmp->data;
- /* this code duplicated from newcham() */
- if(is_male(mdat)) {
- if(mtmp->female) mtmp->female = FALSE;
- } else if (is_female(mdat)) {
- if(!mtmp->female) mtmp->female = TRUE;
- } else if (!is_neuter(mdat)) {
- if(!rn2(10)) mtmp->female = !mtmp->female;
- }
+
+ mgender_from_permonst(mtmp, mdat);
set_mon_data(mtmp, mdat, 0);
if (emits_light(olddata) != emits_light(mtmp->data)) {
/* used to give light, now doesn't, or vice versa,