diff --git a/src/dungeon.c b/src/dungeon.c index 5bd33e25d..5738a36a5 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1464,7 +1464,7 @@ u_on_rndspot(int upflag) 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; @@ -1701,8 +1701,8 @@ get_level(d_level *newlevel, int levnum) 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 { @@ -2147,6 +2147,22 @@ stairs_description( 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", diff --git a/src/mklev.c b/src/mklev.c index 6c639ded0..6b4aab52b 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -836,6 +836,7 @@ makelevel(void) { register struct mkroom *croom; branch *branchp; + stairway *prevstairs; int room_threshold; register s_level *slev = Is_special(&u.uz); int i; @@ -950,9 +951,17 @@ makelevel(void) 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); @@ -1252,7 +1261,7 @@ place_branch(branch *br, /* branch to place */ 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; }