]> git.localhorst.tv Git - blobs.git/blobdiff - src/world/world.cpp
split creature when it's "ripe" lol
[blobs.git] / src / world / world.cpp
index 4f98d9a63bdef3b241123e8cf2bbdf30b76ce3de..91f9bc6751fbaedcda6f67fd1378720c87eda680 100644 (file)
@@ -144,6 +144,14 @@ void Body::Tick(double dt) {
        for (creature::Creature *c : Creatures()) {
                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 {