]> granicus.if.org Git - nethack/commitdiff
Remove unused "mazeflag" parameter from mkfount()
authorcopperwater <aosdict@gmail.com>
Sat, 28 May 2022 14:42:14 +0000 (10:42 -0400)
committercopperwater <aosdict@gmail.com>
Sat, 28 May 2022 14:42:14 +0000 (10:42 -0400)
This parameter appears to have been in the code for a very long time,
but never used, since no version of NetHack I can find had mazes with
randomly placed fountains in them. Certainly isn't used now, so this can
be reduced to the same call to find_okay_roompos used by similar
functions such as mksink.

src/mklev.c

index c49479def17ba7a5937f960702f5bc4b7cbd09c4..f3eb47b0f978535d9c8cea9405dfd7b73d74baf4 100644 (file)
@@ -12,7 +12,7 @@
 static boolean generate_stairs_room_good(struct mkroom *, int);
 static struct mkroom *generate_stairs_find_room(void);
 static void generate_stairs(void);
-static void mkfount(int, struct mkroom *);
+static void mkfount(struct mkroom *);
 static boolean find_okay_roompos(struct mkroom *, coord *);
 static void mksink(struct mkroom *);
 static void mkaltar(struct mkroom *);
@@ -789,7 +789,7 @@ fill_ordinary_room(struct mkroom *croom)
     if (Is_rogue_level(&u.uz))
         goto skip_nonrogue;
     if (!rn2(10))
-        mkfount(0, croom);
+        mkfount(croom);
     if (!rn2(60))
         mksink(croom);
     if (!rn2(60))
@@ -1752,19 +1752,12 @@ generate_stairs(void)
 }
 
 static void
-mkfount(int mazeflag, struct mkroom *croom)
+mkfount(struct mkroom *croom)
 {
     coord m;
-    register int tryct = 0;
 
-    do {
-        if (++tryct > 200)
-            return;
-        if (mazeflag)
-            mazexy(&m);
-        else if (!somexy(croom, &m))
-            return;
-    } while (occupied(m.x, m.y) || bydoor(m.x, m.y));
+    if (!find_okay_roompos(croom, &m))
+        return;
 
     /* Put a fountain at m.x, m.y */
     if (!set_levltyp(m.x, m.y, FOUNTAIN))