mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-28 16:43:29 +00:00
Allowing entities to be deleted
This commit is contained in:
@@ -122,5 +122,7 @@ namespace WAL
|
||||
~Entity() = default;
|
||||
//! @brief An entity is not assignable
|
||||
Entity &operator=(const Entity &) = delete;
|
||||
//! @brief An entity is move assignable.
|
||||
Entity &operator=(Entity &&) = default;
|
||||
};
|
||||
} // namespace WAL
|
||||
@@ -133,7 +133,10 @@ namespace WAL
|
||||
this->_fixedUpdate();
|
||||
}
|
||||
this->_update(dtime);
|
||||
// TODO delete entities scheduled for deletion.
|
||||
auto &entities = this->scene->getEntities();
|
||||
entities.erase(std::remove_if(entities.begin(), entities.end(), [](auto &entity) {
|
||||
return entity.shouldDelete();
|
||||
}), entities.end());
|
||||
callback(*this, state);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user