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.
This commit is contained in:
Pasi Kallinen
2016-01-06 03:32:42 +02:00
parent de5ed30cd7
commit f314fe87bd
3 changed files with 9 additions and 5 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -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 {