another monster gender name handling tweak

ensure that monster female name variation ends up as a female during ^G

arbitrate when there is a conflict between gender term (male or female) and
a gender-tied monster name (cavewoman) during ^G; gender term wins
This commit is contained in:
nhmall
2020-12-28 14:02:22 -05:00
parent 524f9dd82b
commit f30bb8aaa4
3 changed files with 47 additions and 7 deletions

View File

@@ -461,7 +461,10 @@ remove M2_MALE flag that was unintentionally left on dwarf lord/lady/leader
entry and was preventing female incarnations
tilemap.c wasn't building if STATUES_LOOK_LIKE_MONSTERS wasn't defined; also,
to match the code that should be defined so change the preprocessor
test to 'ifndef STATUES_DONT_LOOK_LIKE_MONSTERS'
test to 'ifndef STATUES_DONT_LOOK_LIKE_MONSTERS'
ensure that monster female name variation ends up as a female during ^G
arbitrate when there is a conflict between gender term (male or female) and
a gender-tied monster name (cavewoman) during ^G; gender term wins
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -628,7 +628,8 @@ struct role_filter {
struct _create_particular_data {
int quan;
int which;
int fem;
int fem; /* -1, MALE, FEMALE, NEUTRAL */
int genderconf; /* conflicting gender */
char monclass;
boolean randmonst;
boolean maketame, makepeaceful, makehostile;

View File

@@ -2454,7 +2454,8 @@ struct _create_particular_data *d;
d->quan = 1 + ((g.multi > 0) ? g.multi : 0);
d->monclass = MAXMCLASSES;
d->which = g.urole.malenum; /* an arbitrary index into mons[] */
d->fem = -1; /* gender not specified */
d->fem = -1; /* gender not specified */
d->genderconf = -1; /* no confusion on which gender to assign */
d->randmonst = FALSE;
d->maketame = d->makepeaceful = d->makehostile = FALSE;
d->sleeping = d->saddled = d->invisible = d->hidden = FALSE;
@@ -2521,8 +2522,19 @@ struct _create_particular_data *d;
/*
* With the introduction of male and female monster names
* in 3.7, preserve that detail.
*
* If d->fem is already set to MALE or FEMALE at this juncture, it means
* one of those terms was explicitly specified.
*/
d->fem = gender_name_var;
if (d->fem == MALE || d->fem == FEMALE) { /* explicity expressed */
if ((gender_name_var != NEUTRAL) && (d->fem != gender_name_var)) {
/* apparent selection incompatibility */
d->genderconf = gender_name_var; /* resolve later */
}
/* otherwise keep the value of d->fem, as it's okay */
} else { /* no explicit gender term was specified */
d->fem = gender_name_var;
}
if (d->which >= LOW_PM)
return TRUE; /* got one */
d->monclass = name_to_monclass(bufp, &d->which);
@@ -2576,9 +2588,33 @@ struct _create_particular_data *d;
whichpm = mkclass(d->monclass, 0);
else if (d->randmonst)
whichpm = rndmonst();
if (d->fem != -1 && !is_male(whichpm) && !is_female(whichpm))
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
if (d->genderconf == -1) {
/* no confict exists between explicit gender term and
the specified monster name */
if (d->fem != -1 && !is_male(whichpm) && !is_female(whichpm))
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
} else {
/* conundrum alert: an explicit gender term conflicts with an
explicit gender-tied naming term (i.e. male cavewoman) */
/* option not gone with: name overrides the explicit gender as
commented out here */
/* d->fem = d->genderconf; */
/* option chosen: let the explicit gender term (male or female)
override the gender-tied naming term, so leave d->fem as-is */
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
/* another option would be to consider it a faulty specification
and reject the request completely and produce a random monster
with a gender matching that specified instead (i.e. there is
no such thing as a male cavewoman) */
/* whichpm = rndmonst(); */
/* mmflags |= (d->fem == FEMALE) ? MM_FEMALE : MM_MALE; */
}
mtmp = makemon(whichpm, u.ux, u.uy, mmflags);
if (!mtmp) {
/* quit trying if creation failed and is going to repeat */