]> granicus.if.org Git - nethack/commitdiff
new makemon() flag
authornethack.allison <nethack.allison>
Sat, 19 Jul 2003 12:24:32 +0000 (12:24 +0000)
committernethack.allison <nethack.allison>
Sat, 19 Jul 2003 12:24:32 +0000 (12:24 +0000)
add a flag to makemon() to allow monster to be created adjacent to the supplied  coordinates if there is already a monster at the target location

doc/fixes34.2
include/hack.h
src/makemon.c

index 9bdee7ca371cb68b7d30dd0711f519eac3f235e6..86b17bd8d7bf7146b9235619ce95ee8aab8ffcc4 100644 (file)
@@ -106,6 +106,8 @@ never display I symbol on the mounted hero/steed location
 pit digging is no longer stopped by a sleeping monster next to you
 ensure mksobj() always attaches timer to corpse, even if called with init FALSE
 only charge for eating one stacked tin, not all at once
+add flag to makemon() to allow monster to be created adjacent to the supplied 
+       coordinates if there is already a monster at the target location
 
 
 Platform- and/or Interface-Specific Fixes
index ea54f9f87be6b2fede01cd1b31752416eda14b5c..7717fa7dd8ef2f5dc2453e886d49e42abc78240d 100644 (file)
@@ -140,6 +140,7 @@ NEARDATA extern coord bhitpos;      /* place where throw or zap hits or stops */
 #define MM_NONAME        0x20  /* monster is not christened */
 #define MM_NOCOUNTBIRTH          0x40  /* don't increment born counter (for revival) */
 #define MM_IGNOREWATER   0x80  /* ignore water when positioning */
+#define MM_ADJACENTOK    0x100 /* its acceptable to use adjacent coordinates */
 
 /* flags for special ggetobj status returns */
 #define ALL_FINISHED     0x01  /* called routine already finished the job */
index eccb363f43f6897d6594fc757af1738cf4cd6015..8e936ba0eed54ec60859d54b8164b9dea858d5aa 100644 (file)
@@ -790,9 +790,18 @@ register int       mmflags;
                        return((struct monst *)0);
        }
 
-       /* if a monster already exists at the position, return */
-       if(MON_AT(x, y))
-               return((struct monst *) 0);
+       /* Does monster already exist at the position? */
+       if(MON_AT(x, y)) {
+               if ((mmflags & MM_ADJACENTOK) != 0) {
+                       coord bypos;
+                       if(enexto_core(&bypos, x, y, ptr, gpflags)) {
+                               x = bypos.x;
+                               y = bypos.y;
+                       } else
+                               return((struct monst *) 0);
+               } else 
+                       return((struct monst *) 0);
+       }
 
        if(ptr){
                mndx = monsndx(ptr);