]> git.localhorst.tv Git - blank.git/blobdiff - src/world/World.cpp
tvec[234]<int> -> ivec[234]
[blank.git] / src / world / World.cpp
index 97dcc0848a40a7936179ee7e4171aac8c29f1fd1..e8b665c992366ca2b5f2ecc0efd63447a2f8d73d 100644 (file)
@@ -234,7 +234,7 @@ Chunk &World::PlayerChunk() {
        return chunks.ForceLoad(player->ChunkCoords());
 }
 
-Chunk &World::Next(const Chunk &to, const glm::tvec3<int> &dir) {
+Chunk &World::Next(const Chunk &to, const glm::ivec3 &dir) {
        const Chunk::Pos tgt_pos = to.Position() + dir;
        return chunks.ForceLoad(tgt_pos);
 }
@@ -257,6 +257,13 @@ void World::Update(int dt) {
                        Resolve(entity, col);
                }
        }
+       for (auto iter = entities.begin(), end = entities.end(); iter != end;) {
+               if (iter->CanRemove()) {
+                       iter = entities.erase(iter);
+               } else {
+                       ++iter;
+               }
+       }
        chunks.Rebase(player->ChunkCoords());
        chunks.Update(dt);
 }