]> granicus.if.org Git - nethack/commitdiff
another monster gender name handling tweak
authornhmall <nhmall@nethack.org>
Mon, 28 Dec 2020 19:02:22 +0000 (14:02 -0500)
committernhmall <nhmall@nethack.org>
Mon, 28 Dec 2020 19:02:22 +0000 (14:02 -0500)
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

doc/fixes37.0
include/decl.h
src/read.c

index 95e1a491ec204f0846a3078ff4a2e493e0040aa2..a50894cb1c3941885b8e6e1eb3c3f5459a8501e4 100644 (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
index 0a9b61ba9a683c2d7ec4db648911bedc00d866b7..59f59986624422532af0e8c2a6a19843ad336a52 100644 (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;
index 7ed7cdb5df65dbd4821bc8a31dbd747f79c8e847..a6fa79b1a633784fdc0be525526e84a4eef9ad40 100644 (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 */