b7c4387ab701 entry-07-1
Clean up a bit.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Sat, 13 Oct 2012 15:31:20 -0400 |
parents | 572404588054 |
children | 46c1c8ca77ff |
branches/tags | entry-07-1 |
files | src/caves/core.clj src/caves/ui/drawing.clj src/caves/world/generation.clj |
Changes
--- a/src/caves/core.clj Sat Oct 13 15:15:48 2012 -0400 +++ b/src/caves/core.clj Sat Oct 13 15:31:20 2012 -0400 @@ -34,7 +34,10 @@ (get-input screen))))))) (defn new-game [] - (->Game nil [(->UI :start)] nil {:show-regions false})) + (map->Game {:world nil + :uis [(->UI :start)] + :input nil + :debug-flags {:show-regions false}})) (defn main ([] (main :swing false))
--- a/src/caves/ui/drawing.clj Sat Oct 13 15:15:48 2012 -0400 +++ b/src/caves/ui/drawing.clj Sat Oct 13 15:31:20 2012 -0400 @@ -85,8 +85,7 @@ {:keys [location hp max-hp]} player [x y] location info (str "hp [" hp "/" max-hp "]") - info (str info " loc: [" x "-" y "]") - info (str info " region: [" (get-in game [:world :regions location]) "]")] + info (str info " loc: [" x "-" y "]")] (s/put-string screen 0 hud-row info))) @@ -120,6 +119,7 @@ (get-region-glyph region-number) {:fg :blue})))))) + (defn highlight-player [screen origin player] (let [[x y] (get-viewport-coords-of origin (:location player))] (s/move-cursor screen x y)))
--- a/src/caves/world/generation.clj Sat Oct 13 15:15:48 2012 -0400 +++ b/src/caves/world/generation.clj Sat Oct 13 15:31:20 2012 -0400 @@ -146,5 +146,6 @@ (defn random-world [] (let [world (->World (random-tiles) {}) world (nth (iterate smooth-world world) 3) - world (populate-world world)] - (assoc world :regions (get-region-map (:tiles world))))) + world (populate-world world) + world (assoc world :regions (get-region-map (:tiles world)))] + world))