diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 063a0fae0..131a26118 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1365,6 +1365,8 @@ when filling quiver slot, don't bother asking "what do you want to ready?" if no secret doors or corridors on the first two dungeon levels the number of items destroyed by elemental effects is based on the damage randomize the spellbook in the second level of vlad's tower +monsters weren't randomly generating if exactly one square was outside LOS, + and it contained a monster Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/hack.h b/include/hack.h index 584228510..f6be51f7b 100644 --- a/include/hack.h +++ b/include/hack.h @@ -1073,33 +1073,36 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */ /* flags to control makemon(); goodpos() uses some plus has some of its own*/ -#define NO_MM_FLAGS 0x000000L /* use this rather than plain 0 */ -#define NO_MINVENT 0x000001L /* suppress minvent when creating mon */ -#define MM_NOWAIT 0x000002L /* don't set STRAT_WAITMASK flags */ -#define MM_NOCOUNTBIRTH 0x0004L /* don't increment born count (for revival) */ -#define MM_IGNOREWATER 0x0008L /* ignore water when positioning */ -#define MM_ADJACENTOK 0x0010L /* acceptable to use adjacent coordinates */ -#define MM_ANGRY 0x000020L /* monster is created angry */ -#define MM_NONAME 0x000040L /* monster is not christened */ -#define MM_EGD 0x000100L /* add egd structure */ -#define MM_EPRI 0x000200L /* add epri structure */ -#define MM_ESHK 0x000400L /* add eshk structure */ -#define MM_EMIN 0x000800L /* add emin structure */ -#define MM_EDOG 0x001000L /* add edog structure */ -#define MM_ASLEEP 0x002000L /* monsters should be generated asleep */ -#define MM_NOGRP 0x004000L /* suppress creation of monster groups */ -#define MM_NOTAIL 0x008000L /* if a long worm, don't give it a tail */ -#define MM_MALE 0x010000L /* male variation */ -#define MM_FEMALE 0x020000L /* female variation */ -#define MM_NOMSG 0x040000L /* no appear message */ +#define NO_MM_FLAGS 0x00000000L /* use this rather than plain 0 */ +#define NO_MINVENT 0x00000001L /* suppress minvent when creating mon */ +#define MM_NOWAIT 0x00000002L /* don't set STRAT_WAITMASK flags */ +#define MM_NOCOUNTBIRTH 0x00000004L /* don't incr born count (for revival) */ +#define MM_IGNOREWATER 0x00000008L /* ignore water when positioning */ +#define MM_ADJACENTOK 0x00000010L /* ok to use adjacent coordinates */ +#define MM_ANGRY 0x00000020L /* monster is created angry */ +#define MM_NONAME 0x00000040L /* monster is not christened */ +#define MM_EGD 0x00000080L /* add egd structure */ +#define MM_EPRI 0x00000100L /* add epri structure */ +#define MM_ESHK 0x00000200L /* add eshk structure */ +#define MM_EMIN 0x00000400L /* add emin structure */ +#define MM_EDOG 0x00000800L /* add edog structure */ +#define MM_ASLEEP 0x00001000L /* monsters should be generated asleep */ +#define MM_NOGRP 0x00002000L /* suppress creation of monster groups */ +#define MM_NOTAIL 0x00004000L /* if a long worm, don't give it a tail */ +#define MM_MALE 0x00008000L /* male variation */ +#define MM_FEMALE 0x00010000L /* female variation */ +#define MM_NOMSG 0x00020000L /* no appear message */ +#define MM_NOEXCLAM 0x00040000L /* more sedate " appears." + * mesg for ^G */ +#define MM_IGNORELAVA 0x00080000L /* ignore lava when positioning */ +#define MM_MINVIS 0x00100000L /* for ^G/create_particular */ /* if more MM_ flag masks are added, skip or renumber the GP_ one(s) */ -#define GP_ALLOW_XY 0x080000L /* [actually used by enexto() to decide - * whether to make extra call to goodpos()] */ -#define GP_ALLOW_U 0x100000L /* don't reject hero's location */ -#define GP_CHECKSCARY 0x200000L /* check monster for onscary() */ -#define MM_NOEXCLAM 0x400000L /* more sedate " appears." mesg for ^G */ -#define MM_IGNORELAVA 0x800000L /* ignore lava when positioning */ -#define MM_MINVIS 0x01000000L /* for ^G/create_particular */ +#define GP_ALLOW_XY 0x00200000L /* [actually used by enexto() to decide + * whether to make extra call to goodpos()] */ +#define GP_ALLOW_U 0x00400000L /* don't reject hero's location */ +#define GP_CHECKSCARY 0x00800000L /* check monster for onscary() */ +#define GP_AVOID_MONPOS 0x01000000L /* don't accept existing mon location */ +/* 25 bits used */ /* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */ #define CORPSTAT_NONE 0x00 diff --git a/src/makemon.c b/src/makemon.c index 6fd4ccef9..e620741fb 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1067,6 +1067,7 @@ makemon_rnd_goodpos( coordxy nx, ny; boolean good; + gpflags |= GP_AVOID_MONPOS; do { nx = rn1(COLNO - 3, 2); ny = rn2(ROWNO); @@ -1144,7 +1145,7 @@ makemon( countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0), allowtail = ((mmflags & MM_NOTAIL) == 0); mmflags_nht gpflags = (((mmflags & MM_IGNOREWATER) ? MM_IGNOREWATER : 0) - | GP_CHECKSCARY); + | GP_CHECKSCARY | GP_AVOID_MONPOS); fakemon = cg.zeromonst; cc.x = cc.y = 0; diff --git a/src/teleport.c b/src/teleport.c index cb273d0d5..7853f8546 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -86,7 +86,8 @@ goodpos( boolean ignorewater = ((gpflags & MM_IGNOREWATER) != 0), ignorelava = ((gpflags & MM_IGNORELAVA) != 0), checkscary = ((gpflags & GP_CHECKSCARY) != 0), - allow_u = ((gpflags & GP_ALLOW_U) != 0); + allow_u = ((gpflags & GP_ALLOW_U) != 0), + avoid_monpos = ((gpflags & GP_AVOID_MONPOS) != 0); if (!isok(x, y)) return FALSE; @@ -104,6 +105,9 @@ goodpos( return FALSE; } + if (MON_AT(x, y) && avoid_monpos) + return FALSE; + if (mtmp) { struct monst *mtmp2 = m_at(x, y);