From: PatR Date: Wed, 30 Mar 2022 21:41:53 +0000 (-0700) Subject: github issue #716 - teleporting onto pits X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fbb6dc93b918bebea15f181ef3f7c0c377a21b8;p=nethack github issue #716 - teleporting onto pits Implement the suggestion by NetSysFire that a levitating of flying hero won't treat pits and holes as off limits when testing potential destinations during teleport. Closes #716 --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index bba43c658..bafbbfe09 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -854,6 +854,8 @@ kicking a trapped chest and getting the exploding chest result destroyed items at the hero's location rather than the chest's location; because of that it left the exploded chest intact it was possible to destroy a Rider corpse with an exploding chest +when teleporting, don't consider pits/spiked pits/trap doors/holes as unsafe + destination locations if hero is levitating or flying Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/teleport.c b/src/teleport.c index 158bd9778..83652908e 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -284,10 +284,19 @@ static boolean teleok(register int x, register int y, boolean trapok) { if (!trapok) { - /* allow teleportation onto vibrating square, it's not a real trap */ + /* allow teleportation onto vibrating square, it's not a real trap; + also allow pits and holes if levitating or flying */ struct trap *trap = t_at(x, y); - if (trap && trap->ttyp != VIBRATING_SQUARE) + if (!trap) + trapok = TRUE; + else if (trap->ttyp == VIBRATING_SQUARE) + trapok = TRUE; + else if ((is_pit(trap->ttyp) || is_hole(trap->ttyp)) + && (Levitation || Flying)) + trapok = TRUE; + + if (!trapok) return FALSE; } if (!goodpos(x, y, &g.youmonst, 0))