fix #H166 - trapdoors on quest levels
From a bug report, it was possible
to fall from above the quest locate level to below it even though it has
nondiggable floors (hence no trapdoors or holes to pass through). Since
the game can't verify that it is nondiggable (which could vary on a role
by role basis depending upon their quest descriptions) when it is not the
current level, restrict falling past it only when it hasn't been visited
yet. Impose the same restriction for random level teleport. This enforces
proper sequencing of the quest feedback, which was the more significant
thing that went wrong in the reported case (player finally got the full
locate level message on a return visit, when descending from above, after
having already cleared out that level on his way back up from falling).
Once the locate level has been reached or passed, it is no longer a
barrier to falling or random teleport. (When it is eventually visited,
there's no attempt to remember whether it allows holes, since that
information and the corresponding fall check would need to be extended to
every level in the dungeon. Also, controlled teleport is still allowed to
bypass it even when it hasn't yet been visited, so the "enforces proper
sequencing" claim above is an exaggeration.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)teleport.c 3.5 2006/03/18 */
|
||||
/* SCCS Id: @(#)teleport.c 3.5 2006/08/05 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1244,11 +1244,23 @@ random_teleport_level()
|
||||
* monsters sometimes level teleporting out of it into main dungeon.
|
||||
* Also prevent monsters reaching the Sanctum prior to invocation.
|
||||
*/
|
||||
min_depth = In_quest(&u.uz) ? dungeons[u.uz.dnum].depth_start : 1;
|
||||
max_depth = dunlevs_in_dungeon(&u.uz) +
|
||||
if (In_quest(&u.uz)) {
|
||||
int bottom = dunlevs_in_dungeon(&u.uz),
|
||||
qlocate_depth = qlocate_level.dlevel;
|
||||
|
||||
/* if hero hasn't reached the middle locate level yet,
|
||||
no one can randomly teleport past it */
|
||||
if (dunlev_reached(&u.uz) < qlocate_depth)
|
||||
bottom = qlocate_depth;
|
||||
min_depth = dungeons[u.uz.dnum].depth_start;
|
||||
max_depth = bottom + (dungeons[u.uz.dnum].depth_start - 1);
|
||||
} else {
|
||||
min_depth = 1;
|
||||
max_depth = dunlevs_in_dungeon(&u.uz) +
|
||||
(dungeons[u.uz.dnum].depth_start - 1);
|
||||
/* can't reach the Sanctum if the invocation hasn't been performed */
|
||||
if (Inhell && !u.uevent.invoked) max_depth -= 1;
|
||||
/* can't reach Sanctum if the invocation hasn't been performed */
|
||||
if (Inhell && !u.uevent.invoked) max_depth -= 1;
|
||||
}
|
||||
|
||||
/* Get a random value relative to the current dungeon */
|
||||
/* Range is 1 to current+3, current not counting */
|
||||
|
||||
Reference in New Issue
Block a user