From: PatR Date: Sat, 4 Apr 2020 10:29:40 +0000 (-0700) Subject: wizard mode wishing for terrain X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8119c52d8447b5a98c30e83f64371397200772ca;p=nethack wizard mode wishing for terrain 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. --- diff --git a/src/objnam.c b/src/objnam.c index 4565d3b28..5db7e6212 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -3116,6 +3116,7 @@ int locked, trapped; if (madeterrain) { feel_newsym(x, y); /* map the spot where the wish occurred */ + /* hero started at 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 */