From: Pasi Kallinen Date: Sun, 8 Mar 2020 12:03:47 +0000 (+0200) Subject: Make special levels generate objects with genocided monster classes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f18b5bb59b2908c612789301e01dd0301d61839e;p=nethack Make special levels generate objects with genocided monster classes 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 65d8cb411..681953b5f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/include/monflag.h b/include/monflag.h index e887db141..027cf369d 100644 --- a/include/monflag.h +++ b/include/monflag.h @@ -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 */ diff --git a/src/makemon.c b/src/makemon.c index bf9c608bb..959e54869 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -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 diff --git a/src/sp_lev.c b/src/sp_lev.c index b4dedd146..01f71001b 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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)) {