Implement place_room method

This commit is contained in:
Charles Peyrat 2021-01-08 03:45:26 +01:00
parent 42f0c195aa
commit 3229eb8ea7
1 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,16 @@ class Generator:
level[ly][lx] == Tile.FLOOR:
return False
return True
@staticmethod
def place_room(level, y, x, door_y, door_x, room):
rh, rw = len(room), len(room[0])
# maybe place Tile.DOOR here ?
level[door_y][door_x] = Tile.FLOOR
for ry in range(rh):
for rx in range(rw):
if room[y][x] == Tile.FLOOR:
level[y-door_y][y-door_x] = Tile.FLOOR
def corr_meta_info(self):
if random() < self.params["corridor_chance"]:
h_sup = randint(self.params["min_h_corr"], \