detection/#terrain fix for u.uinwater

Discovered while working on an enhancement to #terrain....

Various detect magic (objects, food, &c) performed while underwater
temporarily removes the hero from the water in order to have access
to the regular map.  In 3.4.3, a hangup save during the detection
would leave the hero standing on top of the water.  3.6.0 added a
flag to track should-be-underwater so that during a hangup save the
hero could be put back in when going into the save file.  It also
added #terrain, another situation that uses the remove-from-water
hack while manipulating the map.

The flag wasn't being cleared after use, only during save, so normal
play without a hangup left it pending until next regular save.  The
result being that after restore, the hero would be considered to be
underwater again regardless of current location, and the map display
would be limited to a view of the adjacent spots as if underwater.
Then, any move--even using '.' to rest--would notice that the
'underwater' hero was not at a water location and put things back to
normal, with feedback of "you are on solid land again."  So to the
player, this would seem like a pair of map display and nonsequitor
message issues, not the internal logic one it actually is.
This commit is contained in:
PatR
2016-05-12 18:00:29 -07:00
parent 43df8c0130
commit 088c47a427
2 changed files with 10 additions and 0 deletions

View File

@@ -238,6 +238,10 @@ metabolism adjustments: hero poly'd into metallivore form still needs to eat;
being fainted or unconscious from other than sleep now consumes
nutrition at lower rate, like being asleep already did;
starvation threshold shortened due to slower food use while fainting
after using detection magic or #terrain while underwater, then leaving water
and saving while on land, save would flag you as underwater again and
then restore would limit the map display accordingly; next move would
notice, retify things, and report "you are on solid land again"
Fixes to Post-3.6.0 Problems that Were Exposed Via git Respository

View File

@@ -272,6 +272,7 @@ outgoldmap:
}
newsym(u.ux, u.uy);
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
You_feel("very greedy, and sense gold!");
exercise(A_WIS, TRUE);
display_nhwindow(WIN_MAP, TRUE);
@@ -376,6 +377,7 @@ register struct obj *sobj;
}
newsym(u.ux, u.uy);
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
if (sobj) {
if (sobj->blessed) {
Your("%s %s to tingle and you smell %s.", body_part(NOSE),
@@ -575,6 +577,7 @@ int class; /* an object class, 0 for all */
newsym(u.ux, u.uy);
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
You("detect the %s of %s.", ct ? "presence" : "absence", stuff);
display_nhwindow(WIN_MAP, TRUE);
/*
@@ -826,6 +829,7 @@ outtrapmap:
if (!(glyph_is_trap(glyph) || glyph_is_object(glyph)))
newsym(u.ux, u.uy);
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
You_feel("%s.", cursed_src ? "very greedy" : "entrapped");
/* wait for user to respond, then reset map display to normal */
@@ -1090,6 +1094,7 @@ do_mapping()
for (zy = 0; zy < ROWNO; zy++)
show_map_spot(zx, zy);
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
if (!level.flags.hero_memory || Underwater) {
flush_screen(1); /* flush temp screen */
display_nhwindow(WIN_MAP, TRUE); /* wait */
@@ -1602,6 +1607,7 @@ int which_subset; /* when not full, whether to suppress objs and/or traps */
/* [TODO: highlight hero's location somehow] */
u.uinwater = iflags.save_uinwater, u.uburied = iflags.save_uburied;
iflags.save_uinwater = iflags.save_uburied = 0;
if (save_swallowed)
u.uswallow = 1;
flush_screen(1);