From: PatR Date: Thu, 21 Apr 2022 10:31:32 +0000 (-0700) Subject: corpse gender X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98eebb97d259932803e57f3414402427ed426bbc;p=nethack corpse gender Reported by entrez. Don't make 50% of neuter monsters be flagged as female. It doesn't matter for live monsters but gets inherited by their corpses, where female and non-female corpses stack separately. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index c6a924ea4..2d1993d04 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1158,6 +1158,8 @@ the change for repeat after prefix+command would result in a crash if repeat was attempted after an unassigned key items obtained via wishing while blind were erroneously being marked as 'seen up close' so behaving differently from items picked up off the floor +corpses of neuter monsters had random chance to be flagged as female so would + only stack with others that made the same random choice curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/makemon.c b/src/makemon.c index 691476a6b..f65019df7 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1127,7 +1127,8 @@ makemon( struct monst fakemon; coord cc; int mndx, mcham, ct, mitem; - boolean anymon = !ptr, + boolean femaleok, maleok, + anymon = !ptr, byyou = u_at(x, y), allow_minvent = ((mmflags & NO_MINVENT) == 0), countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0), @@ -1230,10 +1231,13 @@ makemon( /* set up level and hit points */ newmonhp(mtmp, mndx); - if (is_female(ptr) || ((mmflags & MM_FEMALE) && !is_male(ptr))) - mtmp->female = TRUE; - else if (is_male(ptr) || ((mmflags & MM_MALE) && !is_female(ptr))) - mtmp->female = FALSE; + femaleok = (!is_male(ptr) && !is_neuter(ptr)); + maleok = (!is_female(ptr) && !is_neuter(ptr)); + if (is_female(ptr) || ((mmflags & MM_FEMALE) != 0 && femaleok)) + mtmp->female = 1; + else if (is_male(ptr) || ((mmflags & MM_MALE) != 0 && maleok)) + mtmp->female = 0; + /* leader and nemesis gender is usually hardcoded in mons[], but for ones which can be random, it has already been chosen (in role_init(), for possible use by the quest pager code) */ @@ -1241,8 +1245,12 @@ makemon( mtmp->female = g.quest_status.ldrgend; else if (ptr->msound == MS_NEMESIS && quest_info(MS_NEMESIS) == mndx) mtmp->female = g.quest_status.nemgend; + + /* female used to be set randomly here even for neuters on the + grounds that it was ignored, but after corpses were changed to + retain gender it matters because it affects stacking of corpses */ else - mtmp->female = rn2(2); /* ignored for neuters */ + mtmp->female = femaleok ? rn2(2) : 0; if (In_sokoban(&u.uz) && !mindless(ptr)) /* know about traps here */ mtmp->mtrapseen = (1L << (PIT - 1)) | (1L << (HOLE - 1));