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
This commit is contained in:
PatR
2022-03-30 14:41:53 -07:00
parent b0067493c9
commit 8fbb6dc93b
2 changed files with 13 additions and 2 deletions

View File

@@ -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

View File

@@ -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))