From: nethack.allison Date: Sat, 6 Sep 2003 11:01:05 +0000 (+0000) Subject: monster birth limits followup X-Git-Tag: MOVE2GIT~1808 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9091855c66eda1ed985f7faea9eb2faa58ebda8f;p=nethack monster birth limits followup --- diff --git a/src/bones.c b/src/bones.c index 54c585b25..f8f0ac35c 100644 --- a/src/bones.c +++ b/src/bones.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)bones.c 3.4 2002/08/23 */ +/* SCCS Id: @(#)bones.c 3.4 2003/09/06 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -433,8 +433,13 @@ getbones() * set to the magic DEFUNCT_MONSTER cookie value. */ for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) { - if (mtmp->mhpmax == DEFUNCT_MONSTER) mongone(mtmp); - else + if (mtmp->mhpmax == DEFUNCT_MONSTER) { +#if defined(DEBUG) && defined(WIZARD) + pline("Removing defunct monster %s from bones.", + mtmp->data->mname); +#endif + mongone(mtmp); + } else /* to correctly reset named artifacts on the level */ resetobjs(mtmp->minvent,TRUE); } diff --git a/src/makemon.c b/src/makemon.c index 1657582f3..a2c0a15a8 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)makemon.c 3.4 2003/05/25 */ +/* SCCS Id: @(#)makemon.c 3.4 2003/09/06 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -748,30 +748,32 @@ struct monst *mon; * TRUE propagation successful */ boolean -propagate(mndx, tally) +propagate(mndx, tally, ghostly) int mndx; boolean tally; +boolean ghostly; { + boolean result; uchar lim = mbirth_limit(mndx); - boolean not_gone_yet = (!(mons[mndx].geno & G_NOGEN) && - !(mvitals[mndx].mvflags & G_EXTINCT)); - if ((int) mvitals[mndx].born < lim && not_gone_yet) { - if (tally) mvitals[mndx].born++; - /* if it's unique, or we've reached the limit - * don't ever make it again. - */ - if ((mvitals[mndx].born >= lim) || (mons[mndx].geno & G_UNIQ)) { -#if defined(WIZARD) && defined(DEBUG) - if (wizard) - pline("Automatically extinguished %s.", + boolean gone = (mvitals[mndx].mvflags & G_GONE); /* genocided or extinct */ + + result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE; + + /* if it's unique, don't ever make it again */ + if (mons[mndx].geno & G_UNIQ) mvitals[mndx].mvflags |= G_EXTINCT; + + if (mvitals[mndx].born < 255 && tally && (!ghostly || (ghostly && result))) + mvitals[mndx].born++; + if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) && + !(mvitals[mndx].mvflags & G_EXTINCT)) { +#if defined(DEBUG) && defined(WIZARD) + if (wizard) pline("Automatically extinguished %s.", makeplural(mons[mndx].mname)); #endif - mvitals[mndx].mvflags |= G_EXTINCT; - reset_rndmonst(mndx); - } - return TRUE; + mvitals[mndx].mvflags |= G_EXTINCT; + reset_rndmonst(mndx); } - return FALSE; + return result; } /* @@ -858,7 +860,7 @@ register int mmflags; } while(!goodpos(x, y, &fakemon, gpflags) && tryct++ < 50); mndx = monsndx(ptr); } - propagate(mndx, countbirth); + (void) propagate(mndx, countbirth, FALSE); xlth = ptr->pxlth; if (mmflags & MM_EDOG) xlth += sizeof(struct edog); else if (mmflags & MM_EMIN) xlth += sizeof(struct emin); diff --git a/src/restore.c b/src/restore.c index 16a58e9ce..86fae0191 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)restore.c 3.4 2002/08/21 */ +/* SCCS Id: @(#)restore.c 3.4 2003/09/06 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -268,7 +268,7 @@ boolean ghostly; mtmp->data = &mons[offset]; if (ghostly) { int mndx = monsndx(mtmp->data); - if (propagate(mndx, TRUE) == 0) { + if (propagate(mndx, TRUE, ghostly) == 0) { /* cookie to trigger purge in getbones() */ mtmp->mhpmax = DEFUNCT_MONSTER; }