storage: prevent ::next from spinning forever

This commit is contained in:
Michele Caini
2024-02-26 09:20:39 +01:00
parent 4e5b6de873
commit f18c8f14bf
2 changed files with 1 additions and 2 deletions

1
TODO
View File

@@ -32,7 +32,6 @@ TODO:
* range sparse_set::push should return a reverse iterator, it's kinda wrong now
* after non-continuous generation for entity storage:
- get/reset placeholder to position after saving/loading (avoid long lookup)
- basic_storage<...>::next never stops in release when it runs out of entities (well, not an issue probably but still)
- documentation for reserved entities
* no-version entities always return true when compared to tombstones (fixed but test needed)
* storage entity: no emplace/insert, rename and add a fast range-push from above

View File

@@ -957,7 +957,7 @@ class basic_storage<Entity, Entity, Allocator>
do {
ENTT_ASSERT(placeholder < underlying_type::traits_type::to_entity(null), "Invalid element");
entt = underlying_type::traits_type::combine(static_cast<typename underlying_type::traits_type::entity_type>(placeholder++), {});
} while(base_type::current(entt) != underlying_type::traits_type::to_version(tombstone));
} while(base_type::current(entt) != underlying_type::traits_type::to_version(tombstone) && entt != null);
return entt;
}