Move code around so loops placement isn't stopped by walls
This commit is contained in:
parent
5981927dac
commit
bcfde6fa49
|
@ -489,7 +489,6 @@ class Generator:
|
|||
tries += 1
|
||||
|
||||
# post-processing
|
||||
self.place_walls(level)
|
||||
|
||||
# because when a room is placed, it leads to exactly one previously
|
||||
# placed room, the level has a tree like structure with the starting
|
||||
|
@ -500,9 +499,13 @@ class Generator:
|
|||
while tries < self.params["loop_tries"] and \
|
||||
loops < self.params["loop_max"]:
|
||||
tries += 1
|
||||
print(tries)
|
||||
y, x = randint(0, height - 1), randint(0, width - 1)
|
||||
loops += self.add_loop(level, y, x)
|
||||
|
||||
# surround the floor with walls
|
||||
self.place_walls(level)
|
||||
|
||||
# place an exit ladder
|
||||
y, x = randint(0, height - 1), randint(0, width - 1)
|
||||
while level[y][x] != Tile.FLOOR or \
|
||||
|
|
Loading…
Reference in New Issue