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.
This commit is contained in:
Pasi Kallinen
2020-03-08 14:03:47 +02:00
parent 7b226a12cb
commit f18b5bb59b
4 changed files with 7 additions and 3 deletions

View 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

View 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 */

View 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

View File

@@ -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)) {