MCPcopy Create free account
hub / github.com/NetHack/NetHack / dng_bottom

Function dng_bottom

src/trap.c:417–438  ·  view source on GitHub ↗

find "bottom" level of specified dungeon, stopping at quest locate */

Source from the content-addressed store, hash-verified

415
416/* find "bottom" level of specified dungeon, stopping at quest locate */
417staticfn int
418dng_bottom(d_level *lev)
419{
420 int bottom = dunlevs_in_dungeon(lev);
421
422 /* when in the upper half of the quest, don't fall past the
423 middle "quest locate" level if hero hasn't been there yet */
424 if (In_quest(lev)) {
425 int qlocate_depth = qlocate_level.dlevel;
426
427 /* deepest reached < qlocate implies current < qlocate */
428 if (dunlev_reached(lev) < qlocate_depth)
429 bottom = qlocate_depth; /* early cut-off */
430 } else if (In_hell(lev)) {
431 /* if the invocation hasn't been performed yet, the vibrating square
432 level is effectively the bottom of Gehennom; the sanctum level is
433 out of reach until after the invocation */
434 if (!u.uevent.invoked)
435 bottom -= 1;
436 }
437 return bottom;
438}
439
440/* destination dlevel for holes or trapdoors */
441staticfn void

Callers 2

hole_destinationFunction · 0.85
clamp_hole_destinationFunction · 0.85

Calls 3

dunlevs_in_dungeonFunction · 0.85
In_questFunction · 0.85
In_hellFunction · 0.85

Tested by

no test coverage detected