diff --git a/include/extern.h b/include/extern.h index 2e1ad2a09..c8cabacc7 100644 --- a/include/extern.h +++ b/include/extern.h @@ -897,6 +897,7 @@ E void NDECL(domove); E boolean NDECL(overexertion); E void NDECL(invocation_message); E void NDECL(switch_terrain); +E void FDECL(set_uinwater, (int)); E boolean FDECL(pooleffects, (BOOLEAN_P)); E void FDECL(spoteffects, (BOOLEAN_P)); E char *FDECL(in_rooms, (XCHAR_P, XCHAR_P, int)); diff --git a/src/cmd.c b/src/cmd.c index eebfee01d..2c5cbf34e 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -834,7 +834,7 @@ boolean pre, wiztower; (void) memset((genericptr_t)&g.updest, 0, sizeof (dest_area)); u.ustuck = (struct monst *) 0; u.uswallow = u.uswldtim = 0; - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ u.uundetected = 0; /* not hidden, even if means are available */ dmonsfree(); /* purge dead monsters from 'fmon' */ diff --git a/src/detect.c b/src/detect.c index 66d366aee..ca4179a7c 100644 --- a/src/detect.c +++ b/src/detect.c @@ -35,7 +35,7 @@ unconstrain_map() boolean res = u.uinwater || u.uburied || u.uswallow; /* bring Underwater, buried, or swallowed hero to normal map */ - iflags.save_uinwater = u.uinwater, u.uinwater = 0; + iflags.save_uinwater = u.uinwater, u.uinwater = 0; /* bypass set_uinwater() */ iflags.save_uburied = u.uburied, u.uburied = 0; iflags.save_uswallow = u.uswallow, u.uswallow = 0; @@ -46,7 +46,7 @@ unconstrain_map() static void reconstrain_map() { - u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0; + u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0; /* set_uinwater() */ u.uburied = iflags.save_uburied, iflags.save_uburied = 0; u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0; } diff --git a/src/do.c b/src/do.c index ef6bf5c6b..65bec769c 100644 --- a/src/do.c +++ b/src/do.c @@ -96,7 +96,7 @@ boolean pushing; } if (fills_up && u.uinwater && distu(rx, ry) == 0) { - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ docrt(); g.vision_full_recalc = 1; You("find yourself on dry land again!"); @@ -1377,7 +1377,7 @@ boolean at_stairs, falling, portal; fill_pit(u.ux, u.uy); set_ustuck((struct monst *) 0); /* idem */ u.uswallow = u.uswldtim = 0; - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ u.uundetected = 0; /* not hidden, even if means are available */ keepdogs(FALSE); recalc_mapseen(); /* recalculate map overview before we leave the level */ @@ -1495,7 +1495,7 @@ boolean at_stairs, falling, portal; oinit(); /* reassign level dependent obj probabilities */ } reglyph_darkroom(); - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ /* do this prior to level-change pline messages */ vision_reset(); /* clear old level's line-of-sight */ g.vision_full_recalc = 0; /* don't let that reenable vision yet */ diff --git a/src/hack.c b/src/hack.c index 33ddb5a2a..f8624ad6e 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2086,6 +2086,14 @@ switch_terrain() g.context.botl = TRUE; /* update Lev/Fly status condition */ } +/* set or clear u.uinwater */ +void +set_uinwater(in_out) +int in_out; +{ + u.uinwater = in_out; +} + /* extracted from spoteffects; called by spoteffects to check for entering or leaving a pool of water/lava, and by moveloop to check for staying on one; returns true to skip rest of spoteffects */ @@ -2119,7 +2127,7 @@ boolean newspot; /* true if called by spoteffects */ if (!still_inwater) { boolean was_underwater = (Underwater && !Is_waterlevel(&u.uz)); - u.uinwater = 0; /* leave the water */ + set_uinwater(0); /* u.uinwater = 0; leave the water */ if (was_underwater) { /* restore vision */ docrt(); g.vision_full_recalc = 1; diff --git a/src/objnam.c b/src/objnam.c index b8bae7804..4565d3b28 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -3119,7 +3119,7 @@ int locked, trapped; /* hero started at but might not be there anymore (create lava, decline to die, and get teleported away to safety) */ if (u.uinwater && !is_pool(u.ux, u.uy)) { - u.uinwater = 0; /* leave the water */ + set_uinwater(0); /* u.uinwater = 0; leave the water */ docrt(); /* [block/unblock_point was handled by docrt -> vision_recalc] */ } else { diff --git a/src/save.c b/src/save.c index 1bde78213..f7af31a9d 100644 --- a/src/save.c +++ b/src/save.c @@ -104,7 +104,7 @@ dosave0() if (iflags.save_uswallow) u.uswallow = 1, iflags.save_uswallow = 0; if (iflags.save_uinwater) - u.uinwater = 1, iflags.save_uinwater = 0; + u.uinwater = 1, iflags.save_uinwater = 0; /* bypass set_uinwater() */ if (iflags.save_uburied) u.uburied = 1, iflags.save_uburied = 0; diff --git a/src/trap.c b/src/trap.c index 0d5514d10..8d84e88cd 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3805,7 +3805,7 @@ drown() placebc(); } vision_recalc(2); /* unsee old position */ - u.uinwater = 1; + set_uinwater(1); /* u.uinwater = 1 */ under_water(1); g.vision_full_recalc = 1; return FALSE; @@ -3871,7 +3871,7 @@ drown() /* still too much weight */ pline("But in vain."); } - u.uinwater = 1; + set_uinwater(1); /* u.uinwater = 1 */ You("drown."); for (i = 0; i < 5; i++) { /* arbitrary number of loops */ /* killer format and name are reconstructed every iteration @@ -3890,7 +3890,7 @@ drown() pline("You're still drowning."); } if (u.uinwater) { - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ You("find yourself back %s.", Is_waterlevel(&u.uz) ? "in an air bubble" : "on land"); } diff --git a/src/zap.c b/src/zap.c index 8128d1064..192e32fac 100644 --- a/src/zap.c +++ b/src/zap.c @@ -4514,7 +4514,7 @@ short exploding_wand_typ; if (x == u.ux && y == u.uy) { if (u.uinwater) { /* not just `if (Underwater)' */ /* leave the no longer existent water */ - u.uinwater = 0; + set_uinwater(0); /* u.uinwater = 0 */ u.uundetected = 0; docrt(); g.vision_full_recalc = 1;