]> granicus.if.org Git - nethack/commitdiff
monster birth limits followup
authornethack.allison <nethack.allison>
Sat, 6 Sep 2003 11:01:05 +0000 (11:01 +0000)
committernethack.allison <nethack.allison>
Sat, 6 Sep 2003 11:01:05 +0000 (11:01 +0000)
src/bones.c
src/makemon.c
src/restore.c

index 54c585b25d0ffccf6f1c67a8e607015d4ee41a96..f8f0ac35c7881728ea5784d1d94aed08c650ba91 100644 (file)
@@ -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);
                        }
index 1657582f3874d64dba1d5d78d121b3a91367fb2b..a2c0a15a81035d304ba2cd1edb718694a3e9afc4 100644 (file)
@@ -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);
index 16a58e9ce37e77c5ed9029638b87772859b35945..86fae0191abb3fd2f2100553f1a0a7e74b8652ad 100644 (file)
@@ -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; 
                        }