OSDN Git Service

update travis setting
[jnethack/source.git] / src / mklev.c
index ad8f95f..81ca518 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 mklev.c $NHDT-Date: 1550800390 2019/02/22 01:53:10 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
+/* NetHack 3.6 mklev.c $NHDT-Date: 1562455089 2019/07/06 23:18:09 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.63 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Alex Smith, 2017. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -591,6 +591,10 @@ clear_level_structures()
     register int x, y;
     register struct rm *lev;
 
+    /* note:  normally we'd start at x=1 because map column #0 isn't used
+       (except for placing vault guard at <0,0> when removed from the map
+       but not from the level); explicitly reset column #0 along with the
+       rest so that we start the new level with a completely clean slate */
     for (x = 0; x < COLNO; x++) {
         lev = &levl[x][0];
         for (y = 0; y < ROWNO; y++) {
@@ -645,6 +649,7 @@ clear_level_structures()
     xdnstair = ydnstair = xupstair = yupstair = 0;
     sstairs.sx = sstairs.sy = 0;
     xdnladder = ydnladder = xupladder = yupladder = 0;
+    dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0;
     made_branch = FALSE;
     clear_regions();
 }
@@ -743,8 +748,8 @@ makelevel()
         h = 1;
         if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) {
  fill_vault:
-            add_room(vault_x, vault_y, vault_x + w, vault_y + h, TRUE, VAULT,
-                     FALSE);
+            add_room(vault_x, vault_y, vault_x + w, vault_y + h,
+                     TRUE, VAULT, FALSE);
             level.flags.has_vault = 1;
             ++room_threshold;
             fill_room(&rooms[nroom - 1], FALSE);
@@ -1024,6 +1029,13 @@ mklev()
     for (ridx = 0; ridx < SIZE(rooms); ridx++)
         rooms[ridx].orig_rtype = rooms[ridx].rtype;
 
+    /* something like this usually belongs in clear_level_structures()
+       but these aren't saved and restored so might not retain their
+       values for the life of the current level; reset them to default
+       now so that they never do and no one will be tempted to introduce
+       a new use of them for anything on this level */
+    dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0;
+
     reseed_random(rn2);
     reseed_random(rn2_on_display_rng);
 }
@@ -1692,25 +1704,33 @@ struct mkroom *croom;
 #define y_maze_min 2
 
 /*
- * Major level transmutation: add a set of stairs (to the Sanctum) after
- * an earthquake that leaves behind a new topology, centered at inv_pos.
+ * Major level transmutation:  add a set of stairs (to the Sanctum) after
+ * an earthquake that leaves behind a new topology, centered at inv_pos.
  * Assumes there are no rooms within the invocation area and that inv_pos
  * is not too close to the edge of the map.  Also assume the hero can see,
  * which is guaranteed for normal play due to the fact that sight is needed
- * to read the Book of the Dead.
+ * to read the Book of the Dead.  [That assumption is not valid; it is
+ * possible that "the Book reads the hero" rather than vice versa if
+ * attempted while blind (in order to make blind-from-birth conduct viable).]
  */
 void
 mkinvokearea()
 {
     int dist;
-    xchar xmin = inv_pos.x, xmax = inv_pos.x;
-    xchar ymin = inv_pos.y, ymax = inv_pos.y;
+    xchar xmin = inv_pos.x, xmax = inv_pos.x,
+          ymin = inv_pos.y, ymax = inv_pos.y;
     register xchar i;
 
+    /* slightly odd if levitating, but not wrong */
 /*JP
     pline_The("floor shakes violently under you!");
 */
     pline("\82 \82È\82½\82Ì\89º\82Ì\8f°\82ª\93Ë\91R\97h\82ê\82½\81I");
+    /*
+     * TODO:
+     *  Suppress this message if player has dug out all the walls
+     *  that would otherwise be affected.
+     */
 /*JP
     pline_The("walls around you begin to bend and crumble!");
 */
@@ -1775,8 +1795,7 @@ int dist;
     /* clip at existing map borders if necessary */
     if (!within_bounded_area(x, y, x_maze_min + 1, y_maze_min + 1,
                              x_maze_max - 1, y_maze_max - 1)) {
-        /* only outermost 2 columns and/or rows may be truncated due to edge
-         */
+        /* outermost 2 columns and/or rows may be truncated due to edge */
         if (dist < (7 - 2))
             panic("mkinvpos: <%d,%d> (%d) off map edge!", x, y, dist);
         return;