about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2019-05-22 18:06:58 +0200
committersternenseemann <git@lukasepple.de>2019-05-22 18:06:58 +0200
commite45c1189ab22f599b3d4864f255fa2d3331c446c (patch)
tree4858a3b5e263be4600ed0f2edc4b15a34f2790da
parent84bf99dd7d78ebbafef5d45020ee1b0b0f6687ec (diff)
don't collect info about destroyed objects
-rw-r--r--lib/Grav2ty/Control.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Grav2ty/Control.hs b/lib/Grav2ty/Control.hs
index 266db8d..5eeeeaf 100644
--- a/lib/Grav2ty/Control.hs
+++ b/lib/Grav2ty/Control.hs
@@ -71,8 +71,10 @@ updateState t extract state = set world newWorld . updateState $ state
   where oldWorld = state^.world
         (newWorld, updateState) = tailCall oldWorld ([], id)
         tailCall [] acc = acc
-        tailCall (x:xs) (nw, f) = tailCall xs
-          (if coll x then nw else updateObject' x : nw, extract x . f)
+        tailCall (x:xs) (nw, f) = tailCall xs $
+          if coll x
+             then (nw, f)
+             else (updateObject' x : nw, extract x . f)
         coll obj = isDynamic obj && collisionWithWorld oldWorld obj
         scaledT = state^.control^.ctrlTimeScale * t
         updateObject' obj = updateObject scaledT (gravitationForces oldWorld obj)