makemon and goodpos flags

I added another goodpos flag to simplify handling displacer beast
and that pushed the total number of makemon and goodpos flags past
16.  'int' and 'unsigned' might be too small, so change the flags
and several function arguments to 'long'.
This commit is contained in:
PatR
2020-05-04 09:19:37 -07:00
parent 28ae203ad7
commit 88461e1923
4 changed files with 51 additions and 50 deletions

View File

@@ -22,8 +22,7 @@ static void FDECL(m_initgrp, (struct monst *, int, int, int, int));
static void FDECL(m_initthrow, (struct monst *, int, int));
static void FDECL(m_initweap, (struct monst *));
static void FDECL(m_initinv, (struct monst *));
static boolean FDECL(makemon_rnd_goodpos, (struct monst *,
unsigned, coord *));
static boolean FDECL(makemon_rnd_goodpos, (struct monst *, long, coord *));
#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)
@@ -1046,11 +1045,11 @@ newmextra()
static boolean
makemon_rnd_goodpos(mon, gpflags, cc)
struct monst *mon;
unsigned gpflags;
long gpflags;
coord *cc;
{
int tryct = 0;
int nx,ny;
int nx, ny;
boolean good;
do {
@@ -1119,7 +1118,7 @@ struct monst *
makemon(ptr, x, y, mmflags)
register struct permonst *ptr;
register int x, y;
int mmflags;
long mmflags;
{
register struct monst *mtmp;
struct monst fakemon;
@@ -1425,7 +1424,7 @@ int mmflags;
struct monst *
unmakemon(mon, mmflags)
struct monst *mon;
int mmflags;
long mmflags;
{
boolean countbirth = ((mmflags & MM_NOCOUNTBIRTH) == 0);
int mndx = monsndx(mon->data);

View File

@@ -42,7 +42,7 @@ boolean
goodpos(x, y, mtmp, gpflags)
int x, y;
struct monst *mtmp;
unsigned gpflags;
long gpflags;
{
struct permonst *mdat = (struct permonst *) 0;
boolean ignorewater = ((gpflags & MM_IGNOREWATER) != 0),
@@ -147,7 +147,7 @@ enexto_core(cc, xx, yy, mdat, entflags)
coord *cc;
xchar xx, yy;
struct permonst *mdat;
unsigned entflags;
long entflags;
{
#define MAX_GOOD 15
coord good[MAX_GOOD], *good_ptr;
@@ -251,28 +251,28 @@ int x1, y1, x2, y2;
return FALSE;
if (g.dndest.nlx > 0) {
/* if inside a restricted region, can't teleport outside */
if (within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
g.dndest.nhy)
if (within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy)
&& !within_bounded_area(x2, y2, g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy))
return FALSE;
/* and if outside, can't teleport inside */
if (!within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
g.dndest.nhy)
&& within_bounded_area(x2, y2, g.dndest.nlx, g.dndest.nly, g.dndest.nhx,
g.dndest.nhy))
if (!within_bounded_area(x1, y1, g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy)
&& within_bounded_area(x2, y2, g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy))
return FALSE;
}
if (g.updest.nlx > 0) { /* ditto */
if (within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly, g.updest.nhx,
g.updest.nhy)
if (within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly,
g.updest.nhx, g.updest.nhy)
&& !within_bounded_area(x2, y2, g.updest.nlx, g.updest.nly,
g.updest.nhx, g.updest.nhy))
return FALSE;
if (!within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly, g.updest.nhx,
g.updest.nhy)
&& within_bounded_area(x2, y2, g.updest.nlx, g.updest.nly, g.updest.nhx,
g.updest.nhy))
if (!within_bounded_area(x1, y1, g.updest.nlx, g.updest.nly,
g.updest.nhx, g.updest.nhy)
&& within_bounded_area(x2, y2, g.updest.nlx, g.updest.nly,
g.updest.nhx, g.updest.nhy))
return FALSE;
}
return TRUE;
@@ -1126,7 +1126,7 @@ unsigned trflags;
char verbbuf[BUFSZ];
boolean intentional = FALSE;
if ((trflags & (VIASITTING|FORCETRAP)) != 0) {
if ((trflags & (VIASITTING | FORCETRAP)) != 0) {
Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
intentional = TRUE;
} else
@@ -1181,13 +1181,15 @@ struct monst *mtmp;
return (within_bounded_area(x, y, g.updest.lx, g.updest.ly,
g.updest.hx, g.updest.hy)
&& (!g.updest.nlx
|| !within_bounded_area(x, y, g.updest.nlx, g.updest.nly,
|| !within_bounded_area(x, y,
g.updest.nlx, g.updest.nly,
g.updest.nhx, g.updest.nhy)));
if (g.dndest.lx && (yy & 1) == 0) /* moving down */
return (within_bounded_area(x, y, g.dndest.lx, g.dndest.ly,
g.dndest.hx, g.dndest.hy)
&& (!g.dndest.nlx
|| !within_bounded_area(x, y, g.dndest.nlx, g.dndest.nly,
|| !within_bounded_area(x, y,
g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy)));
} else {
/* [try to] prevent a shopkeeper or temple priest from being
@@ -1497,7 +1499,8 @@ register struct obj *obj;
|| (g.dndest.nlx && On_W_tower_level(&u.uz)
&& within_bounded_area(tx, ty, g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy)
!= within_bounded_area(otx, oty, g.dndest.nlx, g.dndest.nly,
!= within_bounded_area(otx, oty,
g.dndest.nlx, g.dndest.nly,
g.dndest.nhx, g.dndest.nhy)));
if (flooreffects(obj, tx, ty, "fall")) {
@@ -1566,8 +1569,8 @@ random_teleport_level()
max_depth = bottom + (g.dungeons[u.uz.dnum].depth_start - 1);
} else {
min_depth = 1;
max_depth =
dunlevs_in_dungeon(&u.uz) + (g.dungeons[u.uz.dnum].depth_start - 1);
max_depth = dunlevs_in_dungeon(&u.uz)
+ (g.dungeons[u.uz.dnum].depth_start - 1);
/* can't reach Sanctum if the invocation hasn't been performed */
if (Inhell && !u.uevent.invoked)
max_depth -= 1;