]> granicus.if.org Git - nethack/commitdiff
wizard mode buglet: simultaneous Lev+Fly timeout
authorPatR <rankin@nethack.org>
Tue, 24 Nov 2020 18:43:12 +0000 (10:43 -0800)
committerPatR <rankin@nethack.org>
Tue, 24 Nov 2020 18:43:12 +0000 (10:43 -0800)
Noticed while working on Qt status highlighting:  if levitation
and flying timed out at the same time, first Lev timeout called
float_down() which reported
 You have stopped levitating and are now flying.
and then Fly timeout left stale "Fly" on the status line due to
an optimization which got subverted.  ('was_flying' flag was
False due to Fly being blocked by Lev; that's correct behavior,
but the flag is effectively a cached value that becomes stale
when the Lev timeout code executes.)

The bug was wizard mode only because #wizintrinsic is the only
way to get timed flying.

doc/fixes37.0
src/timeout.c

index 19f8eeb9367a3c9152e05fa5da6b1d2683bff622..fbd016ffa3f31e3f62426da611bf3bef9b6d2746 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.361 $ $NHDT-Date: 1606033928 2020/11/22 08:32:08 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.362 $ $NHDT-Date: 1606243387 2020/11/24 18:43:07 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -305,6 +305,9 @@ wand/scroll of create monster or bag of tricks that makes a new monster which
        concealed mimic seen as furniture or an object
 'showscore' could be used to determine how much gold was inside a container
        whose contents were unknown
+wizard mode (only way to get timed flying): if levitation and flying time out
+       on same turn, player was told "You have stopped levitating and are
+       now flying."; status line wasn't updated to remove stale Fly condition
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 9782401b961b1af300bd38ea0b8d1039220c6486..66e56d295b7c712b7b23fd56b3d23e376d2e41b3 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 timeout.c       $NHDT-Date: 1598570054 2020/08/27 23:14:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.119 $ */
+/* NetHack 3.7 timeout.c       $NHDT-Date: 1606243387 2020/11/24 18:43:07 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.122 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -46,11 +46,16 @@ const struct propname {
     { DETECT_MONSTERS, "monster detection" },
     { SEE_INVIS, "see invisible" },
     { INVIS, "invisible" },
-    { DISPLACED, "displaced" }, /* timed amount possible via eating a
-                                 * displacer beast corpse */
-    /* properties beyond here don't have timed values during normal play,
-       so there's not much point in trying to order them sensibly;
-       they're either on or off based on equipment, role, actions, &c */
+    /* timed displacement is possible via eating a displacer beast corpse */
+    { DISPLACED, "displaced" },
+    /* timed pass-walls is a potential prayer result if surrounded by stone
+       with nowhere to be safely teleported to */
+    { PASSES_WALLS, "pass thru walls" },
+    /*
+     * Properties beyond here don't have timed values during normal play,
+     * so there's not much point in trying to order them sensibly.
+     * They're either on or off based on equipment, role, actions, &c.
+     */
     { FIRE_RES, "fire resistance" },
     { COLD_RES, "cold resistance" },
     { SLEEP_RES, "sleep resistance" },
@@ -81,7 +86,6 @@ const struct propname {
     { WWALKING, "water walking" },
     { SWIMMING, "swimming" },
     { MAGICAL_BREATHING, "magical breathing" },
-    { PASSES_WALLS, "pass thru walls" },
     { SLOW_DIGESTION, "slow digestion" },
     { HALF_SPDAM, "half spell damage" },
     { HALF_PHDAM, "half physical damage" },
@@ -676,6 +680,12 @@ nh_timeout()
                 }
                 break;
             case LEVITATION:
+                /* timed Flying is via #wizintrinsic only; still, we want to
+                   avoid float_down() reporting "you have stopped levitating
+                   and are now flying" if both are timing out together;
+                   relies on knowing that Lev timeout is handled before Fly */
+                if ((HFlying & TIMEOUT) == 1L)
+                    --HFlying; /* bypass pending 'case FLYING' */
                 (void) float_down(I_SPECIAL | TIMEOUT, 0L);
                 break;
             case FLYING: