]> git.localhorst.tv Git - blobs.git/blobdiff - src/world/world.cpp
more variety over age
[blobs.git] / src / world / world.cpp
index 4f98d9a63bdef3b241123e8cf2bbdf30b76ce3de..19f6f4af6603607c3eb709a832defcad0215a26c 100644 (file)
@@ -142,8 +142,17 @@ void Body::Tick(double dt) {
        rotation += dt * AngularMomentum() / Inertia();
        Cache();
        for (creature::Creature *c : Creatures()) {
+               // TODO: this is self modifying, fix it fix it fix it
                c->Tick(dt);
        }
+       for (auto c = Creatures().begin(); c != Creatures().end();) {
+               if ((*c)->Removable()) {
+                       delete *c;
+                       c = Creatures().erase(c);
+               } else {
+                       ++c;
+               }
+       }
 }
 
 void Body::Cache() noexcept {