Add update-gs, which always returns the modified gs and is almost always what you want.
This commit is contained in:
parent
dcc5d430e3
commit
7ca348442d
|
@ -14,6 +14,9 @@
|
||||||
(defmacro with-gs [gs & body]
|
(defmacro with-gs [gs & body]
|
||||||
`(binding [*gamestate* (ref ~gs)] (dosync ~@body)))
|
`(binding [*gamestate* (ref ~gs)] (dosync ~@body)))
|
||||||
|
|
||||||
|
(defmacro update-gs [& body]
|
||||||
|
`(with-gs ~@body (get-gs)))
|
||||||
|
|
||||||
(defn get-gs [] @*gamestate*)
|
(defn get-gs [] @*gamestate*)
|
||||||
|
|
||||||
(defn entity-in [gamestate id] (get-in gamestate [:entities id]))
|
(defn entity-in [gamestate id] (get-in gamestate [:entities id]))
|
||||||
|
|
Loading…
Reference in a new issue