level teleporters vs Ft.Ludios

From newsgroup discussion where slash'em changes have revealed a
latent nethack bug:  prevent placing level teleporters in single-
level branches.  The Knox level doesn't have any level teleporters
(or random traps) but wizard mode wishing could create them there.
They wouldn't do anything because the only possible destination
would be the same level.  Pushing a boulder onto one used to trigger
an infinite loop (and still does in slash'em, which has other
single-level branches besides Ft.Ludios) trying to relocate it.

Boulder pushing was changed 15 years ago to prevent the infinite
loop and to avoid giving "the boulder disappears" message when a
level teleporter failed, but rolling boulder traversal lacked that
same change--it wasn't vulnerable to looping but could give an
inaccurate message claiming that the boulder disappeared when it
actually didn't.  Fixing this is a bit late; rolling boulder trap
creation was recently changed to not choose a path that rolls over
teleportation or level tele traps any more.
This commit is contained in:
PatR
2021-04-12 13:25:52 -07:00
parent a8388c8cb5
commit 8bd08ebb71
7 changed files with 53 additions and 27 deletions

View File

@@ -892,7 +892,7 @@ level_tele(void)
/* if in Knox and the requested level > 0, stay put.
* we let negative values requests fall into the "heaven" loop.
*/
if (Is_knox(&u.uz) && newlev > 0 && !force_dest) {
if (single_level_branch(&u.uz) && newlev > 0 && !force_dest) {
You1(shudder_for_moment);
return;
}
@@ -1532,7 +1532,7 @@ random_teleport_level(void)
int nlev, max_depth, min_depth, cur_depth = (int) depth(&u.uz);
/* [the endgame case can only occur in wizard mode] */
if (!rn2(5) || Is_knox(&u.uz) || In_endgame(&u.uz))
if (!rn2(5) || single_level_branch(&u.uz) || In_endgame(&u.uz))
return cur_depth;
/* What I really want to do is as follows: