|
@@ -91,9 +91,8 @@ proc flowDown(grid: TableRef[Point, GroundType], point: Point): bool =
|
91
|
91
|
# still water, and we return true so that the row above us flows out.
|
92
|
92
|
#
|
93
|
93
|
# Sides that aren't enclosed are flowed down. In complex shapes these
|
94
|
|
-# may fill up areas below them. Where both sides fill up, or one side
|
95
|
|
-# is enclosed and the other fills up, we recursively call ourselves
|
96
|
|
-# to deal with the new situation.
|
|
94
|
+# may fill up areas below them. Where either side fills up, we
|
|
95
|
+# recursively call ourselves to deal with the new situation.
|
97
|
96
|
#
|
98
|
97
|
# Finally, in other cases the cells inbetween the extents become
|
99
|
98
|
# flowing water and we return false.
|
|
@@ -116,7 +115,7 @@ proc flowOut(grid: TableRef[Point, GroundType], point: Point): bool =
|
116
|
115
|
if not right.enclosed:
|
117
|
116
|
rightFilled = grid.flowDown((right.last, point.y + 1))
|
118
|
117
|
|
119
|
|
- if (left.enclosed or leftFilled) and (right.enclosed or rightFilled):
|
|
118
|
+ if leftFilled or rightFilled:
|
120
|
119
|
# We've filled in some holes and now our extents are no longer
|
121
|
120
|
# valid. Recursively call ourselves to figure out what's what.
|
122
|
121
|
return flowOut(grid, point)
|