warning fixes

Using 'ladder' as a variable conflicts with 'struct flag flags'
because of a macro in rm.h.  Also remove or hide a couple of
unused variables.

The hack.c diff is unrelated; just a reformatting bit that I had
laying around.
This commit is contained in:
PatR
2020-11-13 14:11:54 -08:00
parent 6ec55a3624
commit 6cbd2c5d85
5 changed files with 40 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 dungeon.c $NHDT-Date: 1604173730 2020/10/31 19:48:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */
/* NetHack 3.7 dungeon.c $NHDT-Date: 1605305480 2020/11/13 22:11:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.138 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1499,9 +1499,9 @@ int upflag;
}
void
stairway_add(x,y, up, ladder, dest)
int x,y;
boolean up, ladder;
stairway_add(x, y, up, isladder, dest)
int x, y;
boolean up, isladder;
d_level *dest;
{
stairway *tmp = (stairway *)alloc(sizeof(stairway));
@@ -1509,7 +1509,7 @@ d_level *dest;
tmp->sx = x;
tmp->sy = y;
tmp->up = up;
tmp->isladder = ladder;
tmp->isladder = isladder;
assign_level(&(tmp->tolev), dest);
tmp->next = g.stairs;
g.stairs = tmp;
@@ -1536,7 +1536,6 @@ int x,y;
while (tmp && !(tmp->sx == x && tmp->sy == y))
tmp = tmp->next;
return tmp;
}
@@ -1549,28 +1548,26 @@ d_level *fromdlev;
while (tmp) {
if (tmp->tolev.dnum == fromdlev->dnum
&& tmp->tolev.dlevel == fromdlev->dlevel)
return tmp;
break; /* return */
tmp = tmp->next;
}
return tmp;
}
stairway *
stairway_find_from(fromdlev, ladder)
stairway_find_from(fromdlev, isladder)
d_level *fromdlev;
boolean ladder;
boolean isladder;
{
stairway *tmp = g.stairs;
while (tmp) {
if (tmp->tolev.dnum == fromdlev->dnum
&& tmp->tolev.dlevel == fromdlev->dlevel
&& tmp->isladder == ladder)
return tmp;
&& tmp->isladder == isladder)
break; /* return */
tmp = tmp->next;
}
return tmp;
}
@@ -1582,7 +1579,6 @@ boolean up;
while (tmp && !(tmp->up == up))
tmp = tmp->next;
return tmp;
}
@@ -1593,19 +1589,17 @@ stairway_find_ladder()
while (tmp && !tmp->isladder)
tmp = tmp->next;
return tmp;
}
stairway *
stairway_find_type_dir(ladder,up)
boolean ladder, up;
stairway_find_type_dir(isladder, up)
boolean isladder, up;
{
stairway *tmp = g.stairs;
while (tmp && !(tmp->isladder == ladder && tmp->up == up))
while (tmp && !(tmp->isladder == isladder && tmp->up == up))
tmp = tmp->next;
return tmp;
}
@@ -1620,7 +1614,6 @@ boolean up;
return tmp;
tmp = tmp->next;
}
return tmp;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 hack.c $NHDT-Date: 1603507385 2020/10/24 02:43:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.269 $ */
/* NetHack 3.7 hack.c $NHDT-Date: 1605305491 2020/11/13 22:11:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.270 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2991,12 +2991,13 @@ monster_nearby()
for (y = u.uy - 1; y <= u.uy + 1; y++) {
if (!isok(x, y) || (x == u.ux && y == u.uy))
continue;
if ((mtmp = m_at(x, y)) && M_AP_TYPE(mtmp) != M_AP_FURNITURE
if ((mtmp = m_at(x, y)) != 0
&& M_AP_TYPE(mtmp) != M_AP_FURNITURE
&& M_AP_TYPE(mtmp) != M_AP_OBJECT
&& (Hallucination
|| (!mtmp->mpeaceful && !noattacks(mtmp->data)))
&& (!is_hider(mtmp->data) || !mtmp->mundetected)
&& mtmp->mcanmove && !mtmp->msleeping /* aplvax!jcn */
&& mtmp->mcanmove && !mtmp->msleeping
&& !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp))
return 1;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mklev.c $NHDT-Date: 1596498181 2020/08/03 23:43:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.89 $ */
/* NetHack 3.7 mklev.c $NHDT-Date: 1605305491 2020/11/13 22:11:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.96 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Alex Smith, 2017. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1252,7 +1252,8 @@ xchar x, y; /* location */
if (br->type == BR_PORTAL) {
mkportal(x, y, dest->dnum, dest->dlevel);
} else if (make_stairs) {
boolean goes_up = on_level(&br->end1, &u.uz) ? br->end1_up : !br->end1_up;
boolean goes_up = on_level(&br->end1, &u.uz) ? br->end1_up
: !br->end1_up;
stairway_add(x,y, goes_up, FALSE, dest);
levl[x][y].ladder = goes_up ? LA_UP : LA_DOWN;
@@ -1601,9 +1602,11 @@ coord *tm;
void
mkstairs(x, y, up, croom)
xchar x, y;
char up;
struct mkroom *croom;
char up; /* [why 'char' when usage is boolean?] */
struct mkroom *croom UNUSED;
{
d_level dest;
if (!x) {
impossible("mkstairs: bogus stair attempt at <%d,%d>", x, y);
return;
@@ -1618,19 +1621,9 @@ struct mkroom *croom;
|| (dunlev(&u.uz) == dunlevs_in_dungeon(&u.uz) && !up))
return;
if (up) {
d_level dest;
dest.dnum = u.uz.dnum;
dest.dlevel = u.uz.dlevel - 1;
stairway_add(x,y, TRUE, FALSE, &dest);
} else {
d_level dest;
dest.dnum = u.uz.dnum;
dest.dlevel = u.uz.dlevel + 1;
stairway_add(x,y, FALSE, FALSE, &dest);
}
dest.dnum = u.uz.dnum;
dest.dlevel = u.uz.dlevel + (up ? -1 : 1);
stairway_add(x, y, up ? TRUE : FALSE, FALSE, &dest);
levl[x][y].typ = STAIRS;
levl[x][y].ladder = up ? LA_UP : LA_DOWN;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 restore.c $NHDT-Date: 1604513828 2020/11/04 18:17:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.169 $ */
/* NetHack 3.7 restore.c $NHDT-Date: 1605305492 2020/11/13 22:11:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.171 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -916,7 +916,7 @@ NHFILE *nhfp;
stairway_free_all();
while (1) {
if (nhfp->structlevel) {
len += sizeof(buflen);
len += (int) sizeof(buflen);
mread(nhfp->fd, (genericptr_t) &buflen, sizeof buflen);
}
@@ -924,11 +924,12 @@ NHFILE *nhfp;
break;
if (nhfp->structlevel) {
len += sizeof(stairway);
mread(nhfp->fd, (genericptr_t) &stway, sizeof(stairway));
len += (int) sizeof (stairway);
mread(nhfp->fd, (genericptr_t) &stway, sizeof (stairway));
}
stairway_add(stway.sx, stway.sy, stway.up, stway.isladder, &(stway.tolev));
stairway_add(stway.sx, stway.sy, stway.up, stway.isladder,
&(stway.tolev));
}
}
@@ -1157,7 +1158,8 @@ xchar lev;
if (ghostly) {
stairway *stway = g.stairs;
while (stway) {
if (!stway->isladder && !stway->up && stway->tolev.dnum == u.uz.dnum)
if (!stway->isladder && !stway->up
&& stway->tolev.dnum == u.uz.dnum)
break;
stway = stway->next;
}
@@ -1181,7 +1183,6 @@ xchar lev;
br = Is_branchlev(&u.uz);
if (br && u.uz.dlevel == 1) {
d_level ltmp;
stairway *stway;
if (on_level(&u.uz, &br->end1))
assign_level(&ltmp, &br->end2);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 teleport.c $NHDT-Date: 1600468454 2020/09/18 22:34:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
/* NetHack 3.7 teleport.c $NHDT-Date: 1605305493 2020/11/13 22:11:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1261,12 +1261,13 @@ register int x, y;
}
static stairway *
stairway_find_forwiz(ladder, up)
boolean ladder, up;
stairway_find_forwiz(isladder, up)
boolean isladder, up;
{
stairway *stway = g.stairs;
while (stway && !(stway->isladder == ladder && stway->up == up && stway->tolev.dnum == u.uz.dnum))
while (stway && !(stway->isladder == isladder
&& stway->up == up && stway->tolev.dnum == u.uz.dnum))
stway = stway->next;
return stway;
}