void
stairway_add(int x, int y, boolean up, boolean isladder, d_level *dest)
{
- stairway *tmp = (stairway *)alloc(sizeof(stairway));
+ stairway *tmp = (stairway *) alloc(sizeof (stairway));
tmp->sx = x;
tmp->sy = y;
if (levnum <= 0) {
/* can only currently happen in endgame */
levnum = u.uz.dlevel;
- } else if (levnum
- > g.dungeons[dgn].depth_start + g.dungeons[dgn].num_dunlevs - 1) {
+ } else if (levnum > (g.dungeons[dgn].depth_start
+ + g.dungeons[dgn].num_dunlevs - 1)) {
/* beyond end of dungeon, jump to last level */
levnum = g.dungeons[dgn].num_dunlevs;
} else {
Sprintf(eos(outbuf), " to level %d", to_dlev);
}
+ } else if (u.uz.dnum == 0 && u.uz.dlevel == 1 && sway->up) {
+ /* stairs up from level one are a special case; they are marked
+ as having been traversed because the hero obviously started
+ the game by coming down them, but the remote side varies
+ depending on whether the Amulet is being carried */
+ Sprintf(outbuf, "%s%s %s %s",
+ !u.uhave.amulet ? "" : "branch ",
+ stairs, updown,
+ !u.uhave.amulet ? "out of the dungeon"
+ /* minimize our expectations about what comes next */
+ : (on_level(&tolev, &earth_level)
+ || on_level(&tolev, &air_level)
+ || on_level(&tolev, &fire_level)
+ || on_level(&tolev, &water_level))
+ ? "to the Elemental Planes"
+ : "to the end game");
} else {
/* known branch stairs; tacking on destination level is too verbose */
Sprintf(outbuf, "branch %s %s to %s",
{
register struct mkroom *croom;
branch *branchp;
+ stairway *prevstairs;
int room_threshold;
register s_level *slev = Is_special(&u.uz);
int i;
do_mkroom(COCKNEST);
skip0:
+ prevstairs = g.stairs; /* used to test for place_branch() success */
/* Place multi-dungeon branch. */
place_branch(branchp, 0, 0);
+ /* for main dungeon level 1, the stairs up where the hero starts
+ are branch stairs; treat them as if hero had just come down
+ them by marking them as having been traversed; most recently
+ created stairway is held in 'g.stairs' */
+ if (u.uz.dnum == 0 && u.uz.dlevel == 1 && g.stairs != prevstairs)
+ g.stairs->u_traversed = TRUE;
+
/* for each room: put things inside */
for (croom = g.rooms; croom->hx > 0; croom++) {
fill_ordinary_room(croom);
boolean goes_up = on_level(&br->end1, &u.uz) ? br->end1_up
: !br->end1_up;
- stairway_add(x,y, goes_up, FALSE, dest);
+ stairway_add(x, y, goes_up, FALSE, dest);
levl[x][y].ladder = goes_up ? LA_UP : LA_DOWN;
levl[x][y].typ = STAIRS;
}