|| vs &&
Add some parentheses.
This commit is contained in:
+15
-11
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 mklev.c $NHDT-Date: 1562455089 2019/07/06 23:18:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.63 $ */
|
/* NetHack 3.6 mklev.c $NHDT-Date: 1587291592 2020/04/19 10:19:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.85 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Alex Smith, 2017. */
|
/*-Copyright (c) Alex Smith, 2017. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -279,10 +279,13 @@ makerooms()
|
|||||||
if (dothemes) {
|
if (dothemes) {
|
||||||
g.in_mk_themerooms = TRUE;
|
g.in_mk_themerooms = TRUE;
|
||||||
g.themeroom_failed = FALSE;
|
g.themeroom_failed = FALSE;
|
||||||
lua_getglobal(g.dungeons[u.uz.dnum].themelua, "themerooms_generate");
|
lua_getglobal(g.dungeons[u.uz.dnum].themelua,
|
||||||
|
"themerooms_generate");
|
||||||
lua_call(g.dungeons[u.uz.dnum].themelua, 0, 0);
|
lua_call(g.dungeons[u.uz.dnum].themelua, 0, 0);
|
||||||
g.in_mk_themerooms = FALSE;
|
g.in_mk_themerooms = FALSE;
|
||||||
if (g.themeroom_failed && ((themeroom_tries++ > 10) || (g.nroom >= (MAXNROFROOMS / 6))))
|
if (g.themeroom_failed
|
||||||
|
&& ((themeroom_tries++ > 10)
|
||||||
|
|| (g.nroom >= (MAXNROFROOMS / 6))))
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1))
|
if (!create_room(-1, -1, -1, -1, -1, -1, OROOM, -1))
|
||||||
@@ -361,8 +364,8 @@ boolean nxcor;
|
|||||||
dest.x = tx;
|
dest.x = tx;
|
||||||
dest.y = ty;
|
dest.y = ty;
|
||||||
|
|
||||||
if (!dig_corridor(&org, &dest, nxcor, g.level.flags.arboreal ? ROOM : CORR,
|
if (!dig_corridor(&org, &dest, nxcor,
|
||||||
STONE))
|
g.level.flags.arboreal ? ROOM : CORR, STONE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* we succeeded in digging the corridor */
|
/* we succeeded in digging the corridor */
|
||||||
@@ -718,7 +721,7 @@ clear_level_structures()
|
|||||||
static void
|
static void
|
||||||
makelevel()
|
makelevel()
|
||||||
{
|
{
|
||||||
register struct mkroom *croom, *troom;
|
register struct mkroom *croom;
|
||||||
register int tryct;
|
register int tryct;
|
||||||
register int x, y;
|
register int x, y;
|
||||||
struct monst *tmonst; /* always put a web with a spider */
|
struct monst *tmonst; /* always put a web with a spider */
|
||||||
@@ -1169,7 +1172,8 @@ coord *mp;
|
|||||||
do
|
do
|
||||||
croom = &g.rooms[rn2(g.nroom)];
|
croom = &g.rooms[rn2(g.nroom)];
|
||||||
while ((croom == g.dnstairs_room || croom == g.upstairs_room
|
while ((croom == g.dnstairs_room || croom == g.upstairs_room
|
||||||
|| (croom->rtype != OROOM && croom->rtype != THEMEROOM)) && (++tryct < 100));
|
|| (croom->rtype != OROOM && croom->rtype != THEMEROOM))
|
||||||
|
&& (++tryct < 100));
|
||||||
} else
|
} else
|
||||||
croom = &g.rooms[rn2(g.nroom)];
|
croom = &g.rooms[rn2(g.nroom)];
|
||||||
|
|
||||||
@@ -1296,10 +1300,10 @@ xchar x, y;
|
|||||||
boolean near_door = bydoor(x, y);
|
boolean near_door = bydoor(x, y);
|
||||||
|
|
||||||
return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL)
|
return ((levl[x][y].typ == HWALL || levl[x][y].typ == VWALL)
|
||||||
&& (isok(x-1,y) && !IS_ROCK(levl[x-1][y].typ)
|
&& ((isok(x - 1, y) && !IS_ROCK(levl[x - 1][y].typ))
|
||||||
|| isok(x+1,y) && !IS_ROCK(levl[x+1][y].typ)
|
|| (isok(x + 1, y) && !IS_ROCK(levl[x + 1][y].typ))
|
||||||
|| isok(x,y-1) && !IS_ROCK(levl[x][y-1].typ)
|
|| (isok(x, y - 1) && !IS_ROCK(levl[x][y - 1].typ))
|
||||||
|| isok(x,y+1) && !IS_ROCK(levl[x][y+1].typ))
|
|| (isok(x, y + 1) && !IS_ROCK(levl[x][y + 1].typ)))
|
||||||
&& g.doorindex < DOORMAX && !near_door);
|
&& g.doorindex < DOORMAX && !near_door);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user