switch_terrain() logic bug causing status updates

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.
This commit is contained in:
PatR
2020-04-04 02:41:13 -07:00
parent 8f73f926b1
commit c8044a202b
2 changed files with 5 additions and 3 deletions

View 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

View 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 */
}