Return value of Generator.run should be a Map
This commit is contained in:
parent
bb3422f7d8
commit
5cbf15bef5
|
@ -110,6 +110,12 @@ class Generator:
|
||||||
self.place_room(level, height//2, width//2, 0, 0, starting_room)
|
self.place_room(level, height//2, width//2, 0, 0, starting_room)
|
||||||
self.params["corridor"] = mem
|
self.params["corridor"] = mem
|
||||||
|
|
||||||
|
# find a starting position
|
||||||
|
sy, sx = randint(0, height-1), randint(0, width-1)
|
||||||
|
while level[sy][sx] != Tile.FLOOR:
|
||||||
|
sy, sx = randint(0, height-1), randint(0, width-1)
|
||||||
|
|
||||||
|
# now we loop until we've tried enough, or we've added enough rooms
|
||||||
tries, rooms_built = 0, 0
|
tries, rooms_built = 0, 0
|
||||||
while tries < self.params["tries"] and rooms_built < self.params["max_rooms"]:
|
while tries < self.params["tries"] and rooms_built < self.params["max_rooms"]:
|
||||||
|
|
||||||
|
@ -124,4 +130,4 @@ class Generator:
|
||||||
# post-processing
|
# post-processing
|
||||||
self.place_walls(level)
|
self.place_walls(level)
|
||||||
|
|
||||||
return level
|
return Map(width, height, level, sy, sx)
|
||||||
|
|
Loading…
Reference in New Issue