]> granicus.if.org Git - nethack/commitdiff
switch_terrain() logic bug causing status updates
authorPatR <rankin@nethack.org>
Sat, 4 Apr 2020 09:41:13 +0000 (02:41 -0700)
committerPatR <rankin@nethack.org>
Sat, 4 Apr 2020 09:41:13 +0000 (02:41 -0700)
When moving onto a different terrain type, the logic for whether to
block or unblock levitation and flying (for the case of moving in
or out of walls and solid stone with Passes_walls while levitating)
was correct but the XOR logic for whether to do a status update
because of such a change was incorrect.  So stepping from room floor
to furniture or to doorway and vice versa or from corridor to doorway
and vice versa was requesting a status update when there was no need
for one.

Some other code must be requesting a status update when it is needed
for this (or possibly even more often than that?) because the status
line does seem to show the current state of Lev and Fly accurately.
Otherwise this should have been noticed when switch_terrain() was
first implemented.

doc/fixes37.0
src/hack.c

index f968cfb0c5a9d8e7a9f16ccddea09fcd9cdcd0de..e2c36003c1f1b7a29548c32b6151ef9a710dfc1c 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.149 $ $NHDT-Date: 1585778315 2020/04/01 21:58:35 $
+$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.151 $ $NHDT-Date: 1585993266 2020/04/04 09:41:06 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -101,6 +101,8 @@ level compiler creates correct novel with supplied name
 for farlook, describe water in the castle moat and in Juiblex's swamp as moat
        and as swamp, respectively, rather than just as "water"
 make hezrous emit poison clouds when they move
+stepping from one type of terrain to another was triggering an unnecessary
+       status update
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index a2fb0f734ba815ee85e698ce104d8e7e870ce2ba..34b18f1c1bf727904d1a562c28357d68edc949ab 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 hack.c  $NHDT-Date: 1584405116 2020/03/17 00:31:56 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.250 $ */
+/* NetHack 3.6 hack.c  $NHDT-Date: 1585993266 2020/04/04 09:41:06 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.254 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2082,7 +2082,7 @@ switch_terrain()
         if (Flying)
             You("start flying.");
     }
-    if ((!Levitation ^ was_levitating) || (!Flying ^ was_flying))
+    if ((!!Levitation ^ was_levitating) || (!!Flying ^ was_flying))
         g.context.botl = TRUE; /* update Lev/Fly status condition */
 }