]> granicus.if.org Git - nethack/commitdiff
wizard mode wishing for terrain
authorPatR <rankin@nethack.org>
Sat, 4 Apr 2020 10:29:40 +0000 (03:29 -0700)
committerPatR <rankin@nethack.org>
Sat, 4 Apr 2020 10:29:40 +0000 (03:29 -0700)
Changing terrain type without moving wasn't registering as moving to
different terrain.  A Passes_walls hero who has levitation blocked
while moving through solid rock can wish for furniture.  Levitation
remained blocked unless hero moved off that spot and then back on.

Doesn't affect normal play.  Changing terrain by digging already
deals with similar situation; not sure whether there are any other
situations that might need to handle it.

src/objnam.c

index 4565d3b28282a73177c8e94366da461af32e9c61..5db7e62126b7d0eeffe53953bfde7d6e4535eecb 100644 (file)
@@ -3116,6 +3116,7 @@ int locked, trapped;
 
     if (madeterrain) {
         feel_newsym(x, y); /* map the spot where the wish occurred */
+
         /* hero started at <x,y> but might not be there anymore (create
            lava, decline to die, and get teleported away to safety) */
         if (u.uinwater && !is_pool(u.ux, u.uy)) {
@@ -3134,6 +3135,7 @@ int locked, trapped;
                     unblock_point(x, y);
             }
         }
+
         /* fixups for replaced terrain that aren't handled above;
            for fountain placed on fountain or sink placed on sink, the
            increment above gets canceled out by the decrement here;
@@ -3156,6 +3158,11 @@ int locked, trapped;
         }
         /* note: lev->lit and lev->nondiggable retain their values even
            though those might not make sense with the new terrain */
+
+        /* might have changed terrain from something that blocked
+           levitation and flying to something that doesn't (levitating
+           while in xorn form and replacing solid stone with furniture) */
+        switch_terrain();
     }
     if (madeterrain || badterrain) {
         /* cast 'const' away; caller won't modify this */