Oselect() for monster's weapon

Make the Oselect() macro less likely to accidentally interfere with
caller's if-then-else usage.
This commit is contained in:
PatR
2021-08-17 16:31:14 -07:00
parent 91ab9b313a
commit c99895ad20

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 weapon.c $NHDT-Date: 1607811730 2020/12/12 22:22:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.89 $ */
/* NetHack 3.7 weapon.c $NHDT-Date: 1629243070 2021/08/17 23:31:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.95 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -465,9 +465,11 @@ silver_sears(struct monst *magr UNUSED, struct monst *mdef,
}
static struct obj *oselect(struct monst *, int);
#define Oselect(x) \
if ((otmp = oselect(mtmp, x)) != 0) \
return otmp;
#define Oselect(x) \
do { \
if ((otmp = oselect(mtmp, x)) != 0) \
return otmp; \
} while (0)
static struct obj *
oselect(struct monst *mtmp, int x)