]> granicus.if.org Git - nethack/commitdiff
add MM_ASLEEP makemon() flag and honor it for fill_zoo
authornhmall <nhmall@nethack.org>
Fri, 7 Dec 2018 03:30:15 +0000 (22:30 -0500)
committernhmall <nhmall@nethack.org>
Fri, 7 Dec 2018 03:30:15 +0000 (22:30 -0500)
doc/fixes36.2
include/hack.h
src/makemon.c
src/mkroom.c

index 7f0673f39347df4be2a55e598512a9b407c6b336..421792d3869949fd9b331d5c7f3656a423aaf863 100644 (file)
@@ -251,6 +251,7 @@ hero hit by something that causes inventory items to be destroyed with loss of
        blasted by lightning and dropping hero onto fire trap); [3.6.1 fixed a
        similar problem with more obvious symptom, an "object lost" panic when
        the unholy water was wielded; the fix for that wasn't general enough]
+add MM_ASLEEP makemon() flag and honor it when creating group for fill_zoo
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index 5785b8590f5894eb463e2ab71d8c92f31e5ddc2d..beab7da8a97931ae17d47d519e148edc8b90c9f5 100644 (file)
@@ -253,13 +253,14 @@ typedef struct sortloot_item Loot;
 #define MM_IGNOREWATER 0x00008 /* ignore water when positioning */
 #define MM_ADJACENTOK \
     0x00010               /* it is acceptable to use adjacent coordinates */
-#define MM_ANGRY 0x00020  /* monster is created angry */
+#define MM_ANGRY  0x00020  /* monster is created angry */
 #define MM_NONAME 0x00040 /* monster is not christened */
-#define MM_EGD 0x00100    /* add egd structure */
-#define MM_EPRI 0x00200   /* add epri structure */
-#define MM_ESHK 0x00400   /* add eshk structure */
-#define MM_EMIN 0x00800   /* add emin structure */
-#define MM_EDOG 0x01000   /* add edog structure */
+#define MM_EGD    0x00100    /* add egd structure */
+#define MM_EPRI   0x00200   /* add epri structure */
+#define MM_ESHK   0x00400   /* add eshk structure */
+#define MM_EMIN   0x00800   /* add emin structure */
+#define MM_EDOG   0x01000   /* add edog structure */
+#define MM_ASLEEP 0x02000   /* monsters should be generated asleep */
 
 /* flags for make_corpse() and mkcorpstat() */
 #define CORPSTAT_NONE 0x00
index 33cc7709cf23e3bbb05affe53bf654d347237a8f..e4d799e9b3e2bd33b6f54681aef27a998d5ed8d8 100644 (file)
@@ -18,15 +18,15 @@ STATIC_DCL boolean FDECL(uncommon, (int));
 STATIC_DCL int FDECL(align_shift, (struct permonst *));
 STATIC_DCL boolean FDECL(mk_gen_ok, (int, int, int));
 STATIC_DCL boolean FDECL(wrong_elem_type, (struct permonst *));
-STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int));
+STATIC_DCL void FDECL(m_initgrp, (struct monst *, int, int, int, int));
 STATIC_DCL void FDECL(m_initthrow, (struct monst *, int, int));
 STATIC_DCL void FDECL(m_initweap, (struct monst *));
 STATIC_DCL void FDECL(m_initinv, (struct monst *));
 STATIC_DCL boolean FDECL(makemon_rnd_goodpos, (struct monst *,
                                                unsigned, coord *));
 
-#define m_initsgrp(mtmp, x, y) m_initgrp(mtmp, x, y, 3)
-#define m_initlgrp(mtmp, x, y) m_initgrp(mtmp, x, y, 10)
+#define m_initsgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 3, mmf)
+#define m_initlgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 10, mmf)
 #define toostrong(monindx, lev) (mons[monindx].difficulty > lev)
 #define tooweak(monindx, lev) (mons[monindx].difficulty < lev)
 
@@ -76,9 +76,9 @@ struct permonst *ptr;
 
 /* make a group just like mtmp */
 STATIC_OVL void
-m_initgrp(mtmp, x, y, n)
-register struct monst *mtmp;
-register int x, y, n;
+m_initgrp(mtmp, x, y, n, mmflags)
+struct monst *mtmp;
+int x, y, n, mmflags;
 {
     coord mm;
     register int cnt = rnd(n);
@@ -131,6 +131,8 @@ register int x, y, n;
         if (enexto(&mm, mm.x, mm.y, mtmp->data)) {
             mon = makemon(mtmp->data, mm.x, mm.y, NO_MM_FLAGS);
             if (mon) {
+                if (mmflags & MM_ASLEEP)
+                    mon->msleeping = 1;
                 mon->mpeaceful = FALSE;
                 mon->mavenge = 0;
                 set_malign(mon);
@@ -1193,7 +1195,8 @@ int mmflags;
         newemin(mtmp);
     if (mmflags & MM_EDOG)
         newedog(mtmp);
-
+    if (mmflags & MM_ASLEEP)
+        mtmp->msleeping = 1;
     mtmp->nmon = fmon;
     fmon = mtmp;
     mtmp->m_id = context.ident++;
@@ -1366,12 +1369,12 @@ int mmflags;
     set_malign(mtmp); /* having finished peaceful changes */
     if (anymon) {
         if ((ptr->geno & G_SGROUP) && rn2(2)) {
-            m_initsgrp(mtmp, mtmp->mx, mtmp->my);
+            m_initsgrp(mtmp, mtmp->mx, mtmp->my, mmflags);
         } else if (ptr->geno & G_LGROUP) {
             if (rn2(3))
-                m_initlgrp(mtmp, mtmp->mx, mtmp->my);
+                m_initlgrp(mtmp, mtmp->mx, mtmp->my, mmflags);
             else
-                m_initsgrp(mtmp, mtmp->mx, mtmp->my);
+                m_initsgrp(mtmp, mtmp->mx, mtmp->my, mmflags);
         }
     }
 
index 15cffdc7f9a442ea5b0b4de203b97b1e3441a70e..d0995c7f1d85d29ac3f59afe8cfec44e017826e0 100644 (file)
@@ -341,7 +341,7 @@ struct mkroom *sroom;
                                              : (type == ANTHOLE)
                                                  ? antholemon()
                                                  : (struct permonst *) 0,
-                          sx, sy, NO_MM_FLAGS);
+                          sx, sy, MM_ASLEEP);
             if (mon) {
                 mon->msleeping = 1;
                 if (type == COURT && mon->mpeaceful) {