]> granicus.if.org Git - nethack/commitdiff
Make special levels generate objects with genocided monster classes
authorPasi Kallinen <paxed@alt.org>
Sun, 8 Mar 2020 12:03:47 +0000 (14:03 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 8 Mar 2020 12:08:32 +0000 (14:08 +0200)
If a special level explicitly requests eg. a statue with a genocided
monster class, allow generating it.

Rationale is that those objects were generated before the monsters
became extinct. Also fixes a lua error.

doc/fixes37.0
include/monflag.h
src/makemon.c
src/sp_lev.c

index 65d8cb4113c8b16fbb81940284aed2d7dea7cacf..681953b5f3880981134a26d4dfdf46a92e6a72ef 100644 (file)
@@ -66,6 +66,8 @@ specifying a count when picking [part of] a stack of scrolls of scare monster
        ignored that count and the whole stack was affected
 wizmakemap didn't account for unique monsters and didn't correct monster
        birth counts
+generate objects (eg. statues) with genocided or extinct monster classes
+       in special levels, if requested
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index e887db141901d657cc6a853f0094dd859a20c1de..027cf369d37d36c5ab933e4e1bc835a035a0107e 100644 (file)
@@ -203,5 +203,6 @@ enum ms_sounds {
 #define MV_KNOWS_EGG                        \
     0x0008 /* player recognizes egg of this \
               monster type */
+#define G_IGNORE 0x1000 /* for mkclass(), ignore G_GENOD|G_EXTINCT */
 
 #endif /* MONFLAG_H */
index bf9c608bb47e2a8a292a0ac69f56abce354d0436..959e54869eeaed14c865092055dc56e62ea97c30 100644 (file)
@@ -1592,7 +1592,7 @@ int mndx, mvflagsmask, genomask;
 {
     struct permonst *ptr = &mons[mndx];
 
-    if (g.mvitals[mndx].mvflags & mvflagsmask)
+    if ((g.mvitals[mndx].mvflags & mvflagsmask) && !(genomask & G_IGNORE))
         return FALSE;
     if (ptr->geno & genomask)
         return FALSE;
@@ -1627,6 +1627,7 @@ aligntyp atyp;
 {
     register int first, last, num = 0;
     int k, nums[SPECIAL_PM + 1]; /* +1: insurance for final return value */
+    int ignore = (spc & G_IGNORE);
     int maxmlev, mask = (G_NOGEN | G_UNIQ) & ~spc;
 
     (void) memset((genericptr_t) nums, 0, sizeof nums);
@@ -1655,7 +1656,7 @@ aligntyp atyp;
     for (last = first; last < SPECIAL_PM && mons[last].mlet == class; last++) {
         if (atyp != A_NONE && sgn(mons[last].maligntyp) != sgn(atyp))
             continue;
-        if (mk_gen_ok(last, G_GONE, mask)) {
+        if (mk_gen_ok(last, G_GONE, mask|ignore)) {
             /* consider it; don't reject a toostrong() monster if we
                don't have anything yet (num==0) or if it is the same
                (or lower) difficulty as preceding candidate (non-zero
index b4dedd1468819cdf1a0773b4b2d5d582a41a2809..01f71001b1ef37b0c61346f76e2bd43dbda3b7b0 100755 (executable)
@@ -3313,7 +3313,7 @@ lua_State *L;
         if (montype) {
             if (strlen(montype) == 1
                 && def_char_to_monclass(*montype) != MAXMCLASSES) {
-                pm = mkclass(def_char_to_monclass(*montype), G_NOGEN);
+                pm = mkclass(def_char_to_monclass(*montype), G_NOGEN|G_IGNORE);
             } else {
                 for (i = LOW_PM; i < NUMMONS; i++)
                     if (!strcmpi(mons[i].mname, montype)) {