small fixes arising out of lein ancient changes
This commit is contained in:
		
							parent
							
								
									581a9d97cd
								
							
						
					
					
						commit
						4a0c10fb7a
					
				
					 5 changed files with 11 additions and 13 deletions
				
			
		| 
						 | 
					@ -191,7 +191,7 @@ do
 | 
				
			||||||
      exit 1
 | 
					      exit 1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      lein test
 | 
					    lein test
 | 
				
			||||||
    if [ $? -ne 0 ]
 | 
					    if [ $? -ne 0 ]
 | 
				
			||||||
    then
 | 
					    then
 | 
				
			||||||
      echo "Sub-project ${dir} failed in test" 1>&2
 | 
					      echo "Sub-project ${dir} failed in test" 1>&2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,6 @@
 | 
				
			||||||
  :dependencies [[org.clojure/clojure "1.8.0"]
 | 
					  :dependencies [[org.clojure/clojure "1.8.0"]
 | 
				
			||||||
                 [org.clojure/math.combinatorics "0.1.4"]
 | 
					                 [org.clojure/math.combinatorics "0.1.4"]
 | 
				
			||||||
                 [org.clojure/tools.trace "0.7.9"]
 | 
					                 [org.clojure/tools.trace "0.7.9"]
 | 
				
			||||||
                 [org.clojure/tools.namespace "0.2.10"]
 | 
					                 [org.clojure/tools.namespace "0.2.11"]
 | 
				
			||||||
                 [hiccup "1.0.5"]
 | 
					                 [hiccup "1.0.5"]
 | 
				
			||||||
                 [net.mikera/imagez "0.12.0"]
 | 
					                 [net.mikera/imagez "0.12.0"]])
 | 
				
			||||||
                 [fivetonine/collage "0.2.0"]])
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,7 @@
 | 
				
			||||||
      :author "Simon Brooke"}
 | 
					      :author "Simon Brooke"}
 | 
				
			||||||
  mw-engine.heightmap
 | 
					  mw-engine.heightmap
 | 
				
			||||||
  (:import [java.awt.image BufferedImage])
 | 
					  (:import [java.awt.image BufferedImage])
 | 
				
			||||||
  (:require [fivetonine.collage.util :as collage :only [load-image]]
 | 
					  (:require [mikera.image.core :as imagez :only [filter-image get-pixels]]
 | 
				
			||||||
            [mikera.image.core :as imagez :only [filter-image get-pixels]]
 | 
					 | 
				
			||||||
            [mikera.image.filters :as filters]
 | 
					            [mikera.image.filters :as filters]
 | 
				
			||||||
            [mw-engine.utils :refer [abs get-int get-neighbours map-world]]
 | 
					            [mw-engine.utils :refer [abs get-int get-neighbours map-world]]
 | 
				
			||||||
            [mw-engine.world :refer [make-world]]))
 | 
					            [mw-engine.world :refer [make-world]]))
 | 
				
			||||||
| 
						 | 
					@ -107,14 +106,14 @@
 | 
				
			||||||
  * `imagepath` a file path or URL which indicates an (ideally greyscale) image file."
 | 
					  * `imagepath` a file path or URL which indicates an (ideally greyscale) image file."
 | 
				
			||||||
  ([world imagepath]
 | 
					  ([world imagepath]
 | 
				
			||||||
    (let [heightmap (imagez/filter-image
 | 
					    (let [heightmap (imagez/filter-image
 | 
				
			||||||
                      (imagez/load-image-resource imagepath)
 | 
					                      (imagez/load-image imagepath)
 | 
				
			||||||
                      (filters/grayscale))]
 | 
					                      (filters/grayscale))]
 | 
				
			||||||
      (map-world
 | 
					      (map-world
 | 
				
			||||||
        (map-world world tag-altitude (list heightmap))
 | 
					        (map-world world tag-altitude (list heightmap))
 | 
				
			||||||
        tag-gradient)))
 | 
					        tag-gradient)))
 | 
				
			||||||
   ([imagepath]
 | 
					   ([imagepath]
 | 
				
			||||||
    (let [heightmap (imagez/filter-image
 | 
					    (let [heightmap (imagez/filter-image
 | 
				
			||||||
                      (imagez/load-image-resource imagepath)
 | 
					                      (imagez/load-image imagepath)
 | 
				
			||||||
                      (filters/grayscale))
 | 
					                      (filters/grayscale))
 | 
				
			||||||
          world (make-world (.getWidth heightmap) (.getHeight heightmap))]
 | 
					          world (make-world (.getWidth heightmap) (.getHeight heightmap))]
 | 
				
			||||||
      (map-world
 | 
					      (map-world
 | 
				
			||||||
| 
						 | 
					@ -132,6 +131,6 @@
 | 
				
			||||||
      intensity of the corresponding cell of the image."
 | 
					      intensity of the corresponding cell of the image."
 | 
				
			||||||
  [world imagepath property]
 | 
					  [world imagepath property]
 | 
				
			||||||
    (let [heightmap (imagez/filter-image
 | 
					    (let [heightmap (imagez/filter-image
 | 
				
			||||||
                      (imagez/load-image-resource imagepath)
 | 
					                      (imagez/load-image imagepath)
 | 
				
			||||||
                      (filters/grayscale))]
 | 
					                      (filters/grayscale))]
 | 
				
			||||||
      (map-world world tag-property (list property heightmap))))
 | 
					      (map-world world tag-property (list property heightmap))))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,7 @@
 | 
				
			||||||
  ([world function additional-args]
 | 
					  ([world function additional-args]
 | 
				
			||||||
    (into []
 | 
					    (into []
 | 
				
			||||||
           (pmap (fn [row]
 | 
					           (pmap (fn [row]
 | 
				
			||||||
                    (into [] (mapv
 | 
					                    (into [] (map
 | 
				
			||||||
                             #(apply function
 | 
					                             #(apply function
 | 
				
			||||||
                                     (cons world (cons % additional-args)))
 | 
					                                     (cons world (cons % additional-args)))
 | 
				
			||||||
                             row)))
 | 
					                             row)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(deftest apply-heightmap-test
 | 
					(deftest apply-heightmap-test
 | 
				
			||||||
  (testing "Heightmap functionality"
 | 
					  (testing "Heightmap functionality"
 | 
				
			||||||
           (let [world (apply-heightmap "heightmaps/test9x9.png")
 | 
					           (let [world (apply-heightmap "resources/heightmaps/test9x9.png")
 | 
				
			||||||
                 altitudes (map #(:altitude %) (flatten world))
 | 
					                 altitudes (map #(:altitude %) (flatten world))
 | 
				
			||||||
                 gradients (map #(:gradient %) (flatten world))]
 | 
					                 gradients (map #(:gradient %) (flatten world))]
 | 
				
			||||||
             (is (= (count world) 9) "World should be 9x9")
 | 
					             (is (= (count world) 9) "World should be 9x9")
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
             (is (> (apply + gradients) 0)
 | 
					             (is (> (apply + gradients) 0)
 | 
				
			||||||
                 "At least some gradients must be positive, none should be negative"))
 | 
					                 "At least some gradients must be positive, none should be negative"))
 | 
				
			||||||
           ;; alternate means of making the world, same tests.
 | 
					           ;; alternate means of making the world, same tests.
 | 
				
			||||||
           (let [world (apply-heightmap (world/make-world 9 9) "heightmaps/test9x9.png")
 | 
					           (let [world (apply-heightmap (world/make-world 9 9) "resources/heightmaps/test9x9.png")
 | 
				
			||||||
                 altitudes (map #(:altitude %) (flatten world))
 | 
					                 altitudes (map #(:altitude %) (flatten world))
 | 
				
			||||||
                 gradients (map #(:gradient %) (flatten world))]
 | 
					                 gradients (map #(:gradient %) (flatten world))]
 | 
				
			||||||
             (is (= (count world) 9) "World should be 9x9")
 | 
					             (is (= (count world) 9) "World should be 9x9")
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(deftest apply-valuemap-test
 | 
					(deftest apply-valuemap-test
 | 
				
			||||||
  (testing "Valuemap functionality"
 | 
					  (testing "Valuemap functionality"
 | 
				
			||||||
    (let [image "heightmaps/test9x9.png"
 | 
					    (let [image "resources/heightmaps/test9x9.png"
 | 
				
			||||||
          world (apply-valuemap (apply-heightmap image) image :arbitrary)
 | 
					          world (apply-valuemap (apply-heightmap image) image :arbitrary)
 | 
				
			||||||
          altitudes (map #(:altitude %) (flatten world))
 | 
					          altitudes (map #(:altitude %) (flatten world))
 | 
				
			||||||
          arbitraries (map #(:arbitrary %) (flatten world))]
 | 
					          arbitraries (map #(:arbitrary %) (flatten world))]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue