From: Pasi Kallinen Date: Wed, 6 Jan 2016 01:32:42 +0000 (+0200) Subject: Fix unmapped branch stairs on premapped levels X-Git-Tag: NetHack-3.6.1_RC01~1064^2~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f314fe87bdeb9ed83c1409ca384a56141d5f8b7b;p=nethack Fix unmapped branch stairs on premapped levels This happens when levelporting to the first Sokoban level in wizard mode before visiting the level, causing the branch stairs to not appear until the space it is in comes in sight of the player. The issue was that levels flagged premapped would cause the special level coder to call sokoban_detect() before fixup_special() had a chance to place the branch stairs properly. Fix from Dynahack by Tung Nguyen. --- diff --git a/include/extern.h b/include/extern.h index 49ed2ec6a..1c9c9af6d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1201,6 +1201,7 @@ E boolean FDECL(bad_location, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P)); E void FDECL(place_lregion, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, d_level *)); +E void NDECL(fixup_special); E void NDECL(fumaroles); E void NDECL(movebubbles); E void NDECL(water_friction); diff --git a/src/mkmaze.c b/src/mkmaze.c index f192a3f3c..246dafea4 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -19,7 +19,6 @@ STATIC_DCL void FDECL(maze0xy, (coord *)); STATIC_DCL boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, BOOLEAN_P, d_level *)); -STATIC_DCL void NDECL(fixup_special); STATIC_DCL void NDECL(setup_waterlevel); STATIC_DCL void NDECL(unsetup_waterlevel); @@ -362,7 +361,7 @@ d_level *lev; static boolean was_waterlevel; /* ugh... this shouldn't be needed */ /* this is special stuff that the level compiler cannot (yet) handle */ -STATIC_OVL void +void fixup_special() { register lev_region *r = lregions; @@ -577,7 +576,6 @@ register const char *s; if (*protofile) { Strcat(protofile, LEV_EXT); if (load_special(protofile)) { - fixup_special(); /* some levels can end up with monsters on dead mon list, including light source monsters */ dmonsfree(); diff --git a/src/sp_lev.c b/src/sp_lev.c index 61740b436..79a3bbcc8 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -5863,11 +5863,16 @@ sp_lev *lvl; count_features(); - if (coder->premapped) - sokoban_detect(); if (coder->solidify) solidify_map(); + /* This must be done before sokoban_detect(), + * otherwise branch stairs won't be premapped. */ + fixup_special(); + + if (coder->premapped) + sokoban_detect(); + if (coder->frame) { struct sp_frame *tmpframe; do {