[cleanup] remove useless conditions
This commit is contained in:
parent
71c95968bc
commit
767789458c
1 changed files with 6 additions and 11 deletions
|
@ -114,19 +114,13 @@ class Room:
|
||||||
def generate_tree():
|
def generate_tree():
|
||||||
# init tree
|
# init tree
|
||||||
tree = [Leaf(0, 0, 30, 30, 0)]
|
tree = [Leaf(0, 0, 30, 30, 0)]
|
||||||
# tree = [Leaf(0, 0, 10, 10, 0)]
|
|
||||||
# tree = [Leaf(0, 0, 5, 5, 0)]
|
|
||||||
|
|
||||||
# split leaves until none succeed
|
# split leaves until none succeed
|
||||||
split_done = True
|
# Lists are ordered. Tree will be created and travel from left to right
|
||||||
while split_done:
|
for l in tree:
|
||||||
split_done = False
|
if l.split():
|
||||||
for l in tree:
|
tree.append(l.left_leaf)
|
||||||
if not l.left_leaf and not l.right_leaf:
|
tree.append(l.right_leaf)
|
||||||
if l.split():
|
|
||||||
tree.append(l.left_leaf)
|
|
||||||
tree.append(l.right_leaf)
|
|
||||||
split_done = True
|
|
||||||
|
|
||||||
# create rooms from partitions
|
# create rooms from partitions
|
||||||
tree[0].generate_rooms()
|
tree[0].generate_rooms()
|
||||||
|
@ -166,6 +160,7 @@ def on_draw():
|
||||||
|
|
||||||
label.draw()
|
label.draw()
|
||||||
|
|
||||||
|
|
||||||
def draw_tree(t):
|
def draw_tree(t):
|
||||||
"""
|
"""
|
||||||
:param t: each leave of t will be draw()
|
:param t: each leave of t will be draw()
|
||||||
|
|
Loading…
Reference in a new issue