 
 (defn ghost-town? [settlement]
   (= 0 (.pop settlement)))
+
+(declare update-settlement-fun)
+
+(defn spawn-new-village-from [id-settlement]
+  (try
+    (let [old-village   (get-settlement id-settlement)
+        _               (assert (not (nil? id-settlement)) (str "Unable to find settlement " id-settlement " in game " @game))
+        tribe-id        (.owner old-village)
+        _               (assert (not (nil? tribe-id)) (str "Old village has no owner: " old-village))
+        tribe           (get-tribe tribe-id)
+        _               (assert (not (nil? tribe)) (str "No tribe found with id " tribe-id " in " @game))
+        language        (.language tribe)
+        new-village-name (.name language)
+        new-pos (free-random-land-near (.pos old-village))
+        _               (assert (not (nil? new-pos)))
+        pop-new-village 100
+        pop-old-village (- (.pop old-village) pop-new-village)
+        settlement (Settlement. (get-next-id) new-village-name pop-new-village (.id tribe) new-pos)
+        id-new-settlement (.id settlement)
+        new-settlements-list (conj (.settlements tribe) (.id settlement))
+        _ (update-tribe (assoc tribe :settlements new-settlements-list))
+        _ (swap! game assoc-in [:settlements (.id settlement)] settlement)]
+      (record-event (str "Village " new-village-name " is born from " (.name old-village)) nil)
+      (update-settlement-pop id-settlement pop-old-village)
+      (run-randomly (update-settlement-fun id-new-settlement) (* fastness 3) (* fastness 10)))
+    (catch AssertionError e (println "assertion failed: " (.getMessage e)))))
 
 (defn update-settlement-fun [id-settlement]
   (fn []

(declare run-randomly)
(declare get-settlement)
(declare get-tribe)

(defn get-settlement [id]
  (get-in @game [:settlements id]))

(defn get-tribe [id]
  (get-in @game [:tribe id]))

(defn update-settlement [settlement]
  (let [id (.id settlement)]

  (time (let [img (calc-biome-map (get-world))]
    (def saved-biome-map img))))

;(defn update-biome-map [] )

; --------------------------------------
; Tribe functions
; --------------------------------------
