git issue #717 - avoid putting monsters on scare \

monster and Elbereth unless there's no other choice.

Suggested by NetSysFire, don't create new monsters on top of scrolls
of scare monster.  Not mentioned in the suggestion:  unless they are
a type of monster that isn't affected by such scrolls.  This extends
it to teleport destination too.

Avoid placing a monster on a scroll of scare monster or on engraved
Elbereth if there are other locations available.  Only performed for
callers of goodpos() who explicitly request it, which at the moment
are makemon(), rloc(), and enexto().

Also, propagate 'mmflags_nht' to a bunch of places that were left
using long or unsigned for makemon() and goodpos() flags.  I didn't
attempt to be systematic about that though.

Implements #717
This commit is contained in:
PatR
2022-04-01 05:09:58 -07:00
parent f45e79e1a0
commit f0c7394968
5 changed files with 87 additions and 34 deletions

View File

@@ -1238,7 +1238,7 @@ extern struct mextra *newmextra(void);
extern void copy_mextra(struct monst *, struct monst *);
extern void dealloc_mextra(struct monst *);
extern struct monst *makemon(struct permonst *, int, int, mmflags_nht);
extern struct monst *unmakemon(struct monst *, long);
extern struct monst *unmakemon(struct monst *, mmflags_nht);
extern boolean create_critters(int, struct permonst *, boolean);
extern struct permonst *rndmonst(void);
extern struct permonst *mkclass(char, int);
@@ -2622,9 +2622,10 @@ extern void sysopt_seduce_set(int);
/* ### teleport.c ### */
extern boolean noteleport_level(struct monst *);
extern boolean goodpos(int, int, struct monst *, long);
extern boolean goodpos(int, int, struct monst *, mmflags_nht);
extern boolean enexto(coord *, xchar, xchar, struct permonst *);
extern boolean enexto_core(coord *, xchar, xchar, struct permonst *, long);
extern boolean enexto_core(coord *, xchar, xchar, struct permonst *,
mmflags_nht);
extern void teleds(int, int, int);
extern boolean safe_teleds(int);
extern boolean teleport_pet(struct monst *, boolean);

View File

@@ -295,11 +295,12 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
#define MM_FEMALE 0x020000L /* female variation */
#define MM_NOMSG 0x040000L /* no appear message */
/* 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 an extra call to goodpos()] */
#define GP_ALLOW_U 0x100000L /* don't reject hero's location */
#define MM_NOEXCLAM 0x200000L /* more sedate "<mon> appears." mesg for ^G */
#define MM_IGNORELAVA 0x400000L /* ignore lava when positioning */
#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 "<mon> appears." mesg for ^G */
#define MM_IGNORELAVA 0x800000L /* ignore lava when positioning */
/* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */
#define CORPSTAT_NONE 0x00