]> granicus.if.org Git - nethack/commitdiff
mklev() set xxstairs_room pointers back to NULL upon completion.
authorBart House <bart@barthouse.com>
Sat, 6 Jul 2019 21:18:02 +0000 (14:18 -0700)
committerBart House <bart@barthouse.com>
Sat, 6 Jul 2019 21:18:02 +0000 (14:18 -0700)
When mklev() is called multiple times, previous state stored in the
xxstairs_room pointers can be mistakenly used when making decisions about
the new level being constructed.  This caused non-deterministic level
creation behavior when replaying from a snapshot.

src/mklev.c

index 525e0a58e2f7026498e16a8989705443b27cc718..10f019f82ea19eb768a1e1b51499e1276fff91f8 100644 (file)
@@ -1016,6 +1016,10 @@ mklev()
     for (ridx = 0; ridx < SIZE(rooms); ridx++)
         rooms[ridx].orig_rtype = rooms[ridx].rtype;
 
+    dnstairs_room = NULL;
+    upstairs_room = NULL;
+    sstairs_room = NULL;
+
     reseed_random(rn2);
     reseed_random(rn2_on_display_rng);
 }