diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-16 12:26:01 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-17 23:23:11 +0100 |
| commit | 489db3043caa82942ef7dc5a6d4b1ee30fd56b9d (patch) | |
| tree | 4f5ba8567141bf4955c886d53ceab3907b9502f2 /src/chunk.cpp | |
| parent | d7ea52c8c86e607dc3e7557c96d07910d21be1f4 (diff) | |
a
Diffstat (limited to 'src/chunk.cpp')
| -rw-r--r-- | src/chunk.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp index f4ba079d..351848d0 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -137,15 +137,16 @@ void chunk::add_entity(const std::shared_ptr<entity>& e) _entities.insert(it, e); } -void chunk::remove_entity(entity_const_iterator it) +void chunk::remove_entity(std::size_t i) { - const auto& e = *it; + fm_debug_assert(i < _entities.size()); + const auto& e = _entities[i]; if (!e->is_dynamic()) mark_scenery_modified(false); if (bbox bb; _bbox_for_scenery(*e, bb)) _remove_bbox(bb); - _entities.erase(it); + _entities.erase(_entities.cbegin() + std::ptrdiff_t(i)); } const std::vector<std::shared_ptr<entity>>& chunk::entities() const |
