]> granicus.if.org Git - nethack/commitdiff
fix pull request #527 - cursed levitation
authorPatR <rankin@nethack.org>
Sat, 5 Jun 2021 22:37:03 +0000 (15:37 -0700)
committerPatR <rankin@nethack.org>
Sat, 5 Jun 2021 22:37:03 +0000 (15:37 -0700)
The stair handling reorganization changed drinking a cursed potion
of levitation to only check whether stairs up existed on the level
instead of whether the hero drank the potion while at their spot.
That resulted in always attempting to go up and then getting "you
can't go up here" when not at stairs instead of the intended "you
hit your head on the ceiling".

Fixes #527

doc/fixes37.0
src/potion.c

index 0af4b1b2483c7b614d1d730a3e41f83d3d6ab806..947c85f98052f26bc681648423f5ec28ddddeff6 100644 (file)
@@ -705,6 +705,8 @@ lighting for baalz level defaulted to random and could end up being lit
 when using 'O' to set menu color patterns, the reminder message that the
        boolean menucolors option needs to be set to True for them to work
        was sometimes given even when already True
+stair revamp unintentionally resulted in cursed potion of levitation no longer
+       causing hero to hit head on ceiling
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index b9148f55651f751a1ae60f81bf9cee6d9010b273..e23aa96f86329e2e315c971f4000dd2a837a7dfc 100644 (file)
@@ -1033,13 +1033,15 @@ peffects(struct obj *otmp)
             g.potion_nothing++;
 
         if (otmp->cursed) {
+            stairway *stway;
+
             /* 'already levitating' used to block the cursed effect(s)
                aside from ~I_SPECIAL; it was not clear whether that was
                intentional; either way, it no longer does (as of 3.6.1) */
             HLevitation &= ~I_SPECIAL; /* can't descend upon demand */
             if (BLevitation) {
                 ; /* rising via levitation is blocked */
-            } else if (stairway_find_dir(TRUE)) {
+            } else if ((stway = stairway_at(u.ux, u.uy)) != 0 && stway->up) {
                 (void) doup();
                 /* in case we're already Levitating, which would have
                    resulted in incrementing 'nothing' */