Permalink
Browse files

Use an atom instead of a ref for the entity ID generation.

closes #1
  • Loading branch information...
1 parent 86aa2e4 commit e792d4dc66fea6a9fb539f947d8010f3a33d7efd @sjl committed Jul 14, 2012
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/caves/entities/core.clj
View
7 src/caves/entities/core.clj
@@ -1,18 +1,15 @@
(ns caves.entities.core)
-(def ids (ref 0))
+(def ids (atom 0))
(defprotocol Entity
(tick [this world]
"Update the world to handle the passing of a tick for this entity."))
(defn get-id []
- (dosync
- (let [id @ids]
- (alter ids inc)
- id)))
+ (swap! ids inc))
(defn make-fnmap

0 comments on commit e792d4d

Please sign in to comment.