From c8044a202b9b86b4f8faeeaa202a73660260626f Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 4 Apr 2020 02:41:13 -0700 Subject: [PATCH] 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. --- doc/fixes37.0 | 4 +++- src/hack.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index f968cfb0c..e2c36003c 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/hack.c b/src/hack.c index a2fb0f734..34b18f1c1 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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 */ } -- 2.50.1