# HG changeset patch # User Steve Losh # Date 1342290905 14400 # Node ID 64208ea405c0c25f8a0553c815551bc4b5e55870 # Parent 180b5b981d920e633a03be87cea348dc6dbfb88c Use an atom instead of a ref for the entity ID generation. closes #1 diff -r 180b5b981d92 -r 64208ea405c0 src/caves/entities/core.clj --- a/src/caves/entities/core.clj Sat Jul 14 14:32:49 2012 -0400 +++ b/src/caves/entities/core.clj Sat Jul 14 14:35:05 2012 -0400 @@ -1,7 +1,7 @@ (ns caves.entities.core) -(def ids (ref 0)) +(def ids (atom 0)) (defprotocol Entity (tick [this world] @@ -9,10 +9,7 @@ (defn get-id [] - (dosync - (let [id @ids] - (alter ids inc) - id))) + (swap! ids inc)) (defn make-fnmap