diff --git a/src/mw_engine/drainage.clj b/src/mw_engine/drainage.clj index e50f6ad..e8d5919 100644 --- a/src/mw_engine/drainage.clj +++ b/src/mw_engine/drainage.clj @@ -35,13 +35,14 @@ Flow comes from a higher cell to a lower only if the lower is the lowest neighbour of the higher." [world cell] (cond - (> (or (:altitude cell) 0) *sealevel*) + (not (nil? (:flow cell))) cell + (<= (or (:altitude cell) 0) *sealevel*) cell + true (merge cell {:flow (+ (:rainfall cell) (apply + (map (fn [neighbour] (:flow (flow world neighbour))) - (flow-contributors world cell))))}) - true cell)) + (flow-contributors world cell))))}))) (defn flow-world "Return a world like this `world`, but with cells tagged with the amount of