menus; have bot() check for valid youmonst.data
free storage used to hold region messages in free_region()
honor pushweapon when applying a tool or weapon causes it to become wielded
+in the quest, if the locate level hasn't been reached yet, don't fall or
+ randomly teleport past it
Platform- and/or Interface-Specific Fixes
register schar ret = 0;
for(i = 0; i < n_dgns; i++) {
- if((tmp.dlevel = dungeons[i].dunlev_ureached) == 0) continue;
- if(!strcmp(dungeons[i].dname, "The Quest") && noquest) continue;
-
+ if (noquest && i == quest_dnum) continue;
+ tmp.dlevel = dungeons[i].dunlev_ureached;
+ if (tmp.dlevel == 0) continue;
tmp.dnum = i;
if(depth(&tmp) > ret) ret = depth(&tmp);
}
-/* 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. */
* 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 */
-/* SCCS Id: @(#)trap.c 3.5 2006/06/16 */
+/* SCCS Id: @(#)trap.c 3.5 2006/08/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
d_level dtmp;
char msgbuf[BUFSZ];
const char *dont_fall = 0;
- register int newlevel = dunlev(&u.uz);
+ int newlevel, bottom;
/* KMH -- You can't escape the Sokoban level traps */
if(Blind && Levitation && !In_sokoban(&u.uz)) return;
+ bottom = dunlevs_in_dungeon(&u.uz);
+ /* when in the upper half of the quest, don't fall past the
+ middle "quest locate" level if hero hasn't been there yet */
+ if (In_quest(&u.uz)) {
+ int qlocate_depth = qlocate_level.dlevel;
+
+ /* deepest reached < qlocate implies current < qlocate */
+ if (dunlev_reached(&u.uz) < qlocate_depth)
+ bottom = qlocate_depth; /* early cut-off */
+ }
+ newlevel = dunlev(&u.uz); /* current level */
do {
newlevel++;
- } while(!rn2(4) && newlevel < dunlevs_in_dungeon(&u.uz));
+ } while (!rn2(4) && newlevel < bottom);
if(td) {
struct trap *t = t_at(u.ux,u.uy);
else if(Levitation || u.ustuck
|| (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig)
|| Flying || is_clinger(youmonst.data)
- || (Inhell && !u.uevent.invoked &&
- newlevel == dunlevs_in_dungeon(&u.uz))
+ || (Inhell && !u.uevent.invoked && newlevel == bottom)
) {
dont_fall = "don't fall in.";
} else if (youmonst.data->msize >= MZ_HUGE) {