Fix overflow with room max height and width

This commit is contained in:
kleph 2016-11-10 19:56:53 +01:00
parent df033d257c
commit 1539bcc057

View file

@ -10,7 +10,7 @@ import random
TILE_SIZE_X = 16
TILE_SIZE_Y = 16
MIN_LEAF_SIZE = 7
MIN_LEAF_SIZE = 8
class Leaf:
@ -71,8 +71,8 @@ class Leaf:
def generate_room(self):
x = random.randint(self.x+1, self.x+2)
y = random.randint(self.y+1, self.y+2)
w = random.randint(3, self.width-1)
h = random.randint(3, self.height-1)
w = random.randint(MIN_LEAF_SIZE / 2, self.width - 2)
h = random.randint(MIN_LEAF_SIZE / 2, self.height - 2)
return Room(x, y, w, h, self.id)
def draw(self, ground):