From: PatR Date: Wed, 2 Mar 2016 23:01:21 +0000 (-0800) Subject: monmove.c tweaks X-Git-Tag: NetHack-3.6.1_RC01~891 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0f29e71cde63a6a4c134d2032c00b01de8ed4d4;p=nethack monmove.c tweaks While looking at #H4265 ("Bug - Monsters opening doors" about feedback naming the unseen monster who opened a door), I didn't find the the problem. But I did notice a couple of suspicious constructs. Fix an assignment that gave a boolean variable a value of 16, and add parentheses around 'a & b' in (a & b && c). The latter isn't incorrect, it just looks strange. --- diff --git a/src/monmove.c b/src/monmove.c index d13dc3c61..964db35ee 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 monmove.c $NHDT-Date: 1455402384 2016/02/13 22:26:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.84 $ */ +/* NetHack 3.6 monmove.c $NHDT-Date: 1456959639 2016/03/02 23:00:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.85 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1218,12 +1218,12 @@ postmov: } ptr = mtmp->data; - /* open a door, or crash through it, if you can */ + /* open a door, or crash through it, if 'mtmp' can */ if (IS_DOOR(levl[mtmp->mx][mtmp->my].typ) && !passes_walls(ptr) /* doesn't need to open doors */ && !can_tunnel) { /* taken care of below */ struct rm *here = &levl[mtmp->mx][mtmp->my]; - boolean btrapped = (here->doormask & D_TRAPPED), + boolean btrapped = (here->doormask & D_TRAPPED) != 0, observeit = canseeit && canspotmon(mtmp); if ((here->doormask & (D_LOCKED | D_CLOSED)) != 0 @@ -1296,7 +1296,7 @@ postmov: else if (!Deaf) You_hear("a door crash open."); } - if (here->doormask & D_LOCKED && !rn2(2)) + if ((here->doormask & D_LOCKED) != 0 && !rn2(2)) here->doormask = D_NODOOR; else here->doormask = D_BROKEN;