From: nethack.allison Date: Sat, 19 Jul 2003 12:24:32 +0000 (+0000) Subject: new makemon() flag X-Git-Tag: MOVE2GIT~1893 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9608015ac8e1ed2fce75e6ba4e271bc85c72f887;p=nethack new makemon() flag 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 --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index 9bdee7ca3..86b17bd8d 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 diff --git a/include/hack.h b/include/hack.h index ea54f9f87..7717fa7dd 100644 --- a/include/hack.h +++ b/include/hack.h @@ -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 */ diff --git a/src/makemon.c b/src/makemon.c index eccb363f4..8e936ba0e 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -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);