From abbad0f352553fdb989b48a96d1bb5a9032f4175 Mon Sep 17 00:00:00 2001 From: Charles Peyrat Date: Fri, 8 Jan 2021 05:14:32 +0100 Subject: [PATCH] Fix formulas in place_room and room_fits --- squirrelbattle/mapgeneration/broguelike.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/squirrelbattle/mapgeneration/broguelike.py b/squirrelbattle/mapgeneration/broguelike.py index c208e91..ea3fe46 100644 --- a/squirrelbattle/mapgeneration/broguelike.py +++ b/squirrelbattle/mapgeneration/broguelike.py @@ -36,8 +36,8 @@ class Generator: rh, rw = len(room), len(room[0]) for ry in range(rh): for rx in range(rw): - if room[y][x] == Tile.FLOOR: - ly, lx = ry - door_y, rx - door_x + if room[ry][rx] == Tile.FLOOR: + ly, lx = y + ry - door_y, x + rx - door_x if not(0 <= ly <= rh and 0 <= lx <= rw) or \ level[ly][lx] == Tile.FLOOR: return False @@ -50,8 +50,8 @@ class Generator: 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 + if room[ry][rx] == Tile.FLOOR: + level[y-door_y+ry][y-door_x+rx] = Tile.FLOOR @staticmethod def place_walls(level):