-/* NetHack 3.6 botl.c $NHDT-Date: 1584350350 2020/03/16 09:19:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.186 $ */
+/* NetHack 3.6 botl.c $NHDT-Date: 1585647484 2020/03/31 09:38:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.187 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
static boolean cache_avail[3] = { FALSE, FALSE, FALSE };
static boolean cache_reslt[3] = { FALSE, FALSE, FALSE };
static const char *cache_nomovemsg = NULL, *cache_multi_reason = NULL;
-static d_level cache_uz = { 0 };
-static boolean cache_underwater = FALSE;
#define cond_cache_prepA() \
do { \
} \
} while (0)
-#define cond_cache_prepB() \
-do { \
- if (((cache_uz.dnum != u.uz.dnum) \
- || (cache_uz.dlevel != u.uz.dlevel)) \
- || (cache_underwater != Underwater)) { \
- cache_uz.dnum = 0; \
- cache_uz.dlevel = 0; \
- cache_underwater = 0; \
- cache_reslt[2] = cache_avail[2] = FALSE; \
- } \
-} while (0)
-
/* we don't put this next declaration in #ifdef STATUS_HILITES.
* In the absence of STATUS_HILITES, each array
* element will be 0 however, and quite meaningless,
for that cache lifetime. There is caching of that nature done for
unconsc (1) and parlyz (2) because the suggested way of being able
to distinguish unconsc, parlyz, sleeping, and busy involves multiple
- string comparisons. There is also caching done for submerged (3) to
- avoid repeatedly calling the on_level() function unnecessarily. */
+ string comparisons. */
#define test_if_enabled(c) if (condtests[(c)].enabled) condtests[(c)].test
condtests[bl_stone].test = (Stoned) ? TRUE : FALSE;
condtests[bl_strngl].test = (Strangled) ? TRUE : FALSE;
condtests[bl_stun].test = (Stunned) ? TRUE : FALSE;
+ condtests[bl_submerged].test = (Underwater) ? TRUE : FALSE;
test_if_enabled(bl_elf_iron) = (FALSE);
test_if_enabled(bl_bareh) = (!uarmg && !uwep);
- test_if_enabled(bl_icy) = levl[u.ux][u.uy].typ == ICE;
+ test_if_enabled(bl_icy) = (levl[u.ux][u.uy].typ == ICE);
test_if_enabled(bl_slippery) = (Glib) ? TRUE : FALSE;
test_if_enabled(bl_woundedl) = (Wounded_legs);
condtests[bl_sleeping].test = condtests[bl_busy].test = FALSE;
}
- /* submerged */
- if (condtests[bl_submerged].enabled) {
- cond_cache_prepB();
- if (!cache_avail[2] && cache_underwater == 0
- && (cache_uz.dlevel == 0 && cache_uz.dnum == 0)) {
- cache_uz = u.uz;
- cache_underwater = (Underwater) ? TRUE : FALSE;
- cache_reslt[2] = (Underwater && !Is_waterlevel(&u.uz));
- cache_avail[2] = TRUE;
- }
- if (cache_avail[2]) {
- condtests[bl_submerged].test = cache_reslt[2];
- } else {
- condtests[bl_submerged].test = FALSE;
- }
- } else {
- condtests[bl_submerged].test = FALSE;
- }
-
#define cond_bitset(c) \
g.blstats[idx][BL_CONDITION].a.a_ulong |= conditions[(c)].mask;