]> granicus.if.org Git - nethack/commitdiff
detection/#terrain fix for u.uinwater
authorPatR <rankin@nethack.org>
Fri, 13 May 2016 01:00:29 +0000 (18:00 -0700)
committerPatR <rankin@nethack.org>
Fri, 13 May 2016 01:00:29 +0000 (18:00 -0700)
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.

doc/fixes36.1
src/detect.c

index 5958780369a12f786b066989d80c8b442f32d8fa..37f1d1064e6f6298de08ffcfd69d9696579299b4 100644 (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
index c6133438884bbf9dd23ccfe59a9aa4c825550d87..526c81c6bca8045f75c825a97bdce4c7feeab865 100644 (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);