Merge branch 'master' of ssh://goldsmith.journeyman.cc/srv/git/mw-ui

Conflicts:
	src/mw_ui/routes/home.clj
This commit is contained in:
simon 2014-08-25 17:32:04 +01:00
commit 12ef500c9f
8 changed files with 13 additions and 9865 deletions

View file

@ -47,7 +47,7 @@
(compiler/compile-file
(io/get-resource "/rulesets/basic.txt")))
(session/get :rules)))
generation (+ (or (session/get :generation) 0) 1)
generation (inc (or (session/get :generation) 0))
w2 (engine/transform-world world rules)
]
(session/put! :world w2)

View file

@ -46,8 +46,8 @@
(let [params (keywordize-keys (:params request))
xs (:x params)
ys (:y params)
x (if (not (empty? xs)) (read-string xs) 0)
y (if (not (empty? ys)) (read-string ys) 0)
x (if (seq xs) (read-string xs) 0)
y (if (seq ys) (read-string ys) 0)
world (session/get :world)
cell (engine-utils/get-cell world x y)
state (:state params)]
@ -84,6 +84,7 @@
:pause (or (session/get :pause) 5)
:maybe-refresh "refresh"}))
(defroutes home-routes
(GET "/" [] (home-page))
(GET "/about" [] (about-page))

View file

@ -31,15 +31,14 @@
pause (:pause params)
rulefile (:ruleset params)
rulepath (str "/rulesets/" rulefile ".txt")]
(if (not (= map ""))
(if (not= map "")
(session/put! :world
(heightmap/apply-heightmap
(io/get-resource (str "/img/heightmaps/" map ".png")))))
(if (not (= rulefile ""))
(do
(session/put! :rule-text (io/slurp-resource rulepath))
(session/put! :rules (compiler/compile-file (io/get-resource rulepath)))))
(if (not (= pause ""))
(when (not= rulefile "")
(session/put! :rule-text (io/slurp-resource rulepath))
(session/put! :rules (compiler/compile-file (io/get-resource rulepath))))
(if (not= pause "")
(session/put! :pause pause))
(layout/render "params.html"
(merge (send-params)

View file

@ -16,6 +16,6 @@
[path (str (io/resource-path) directory)]
(session/put! :list-resources-path path)
(sort
(filter #(not (nil? %))
(remove nil?
(map #(first (rest (re-matches pattern (.getName %))))
(file-seq (clojure.java.io/file path)))))))