]> granicus.if.org Git - nethack/commitdiff
Fix unmapped branch stairs on premapped levels
authorPasi Kallinen <paxed@alt.org>
Wed, 6 Jan 2016 01:32:42 +0000 (03:32 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 6 Jan 2016 01:35:58 +0000 (03:35 +0200)
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.

include/extern.h
src/mkmaze.c
src/sp_lev.c

index 49ed2ec6afce752c043dae3143a6fb9f23445a68..1c9c9af6dfcd073965fe66bdabdb1f95a326575f 100644 (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);
index f192a3f3cdfd481ef5bb8626f4536050d5c12f6f..246dafea4cbaecea605dddb3c6d70e044d723bd4 100644 (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();
index 61740b436c89f6229f4b23fe93993c1772a90a9e..79a3bbcc81b2b6b3708a511efb1d71afea83af0b 100644 (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 {