fixed view multi component
This commit is contained in:
@@ -43,7 +43,7 @@ class View<Pool<Components...>, Type, Types...> final {
|
||||
ViewIterator(pool_type &pool, const entity_type *entities, typename pool_type::size_type pos) noexcept
|
||||
: pool{pool}, entities{entities}, pos{pos}
|
||||
{
|
||||
if(pos) { while(!valid() && --pos); }
|
||||
if(this->pos) { while(!valid() && --this->pos); }
|
||||
}
|
||||
|
||||
ViewIterator & operator++() noexcept {
|
||||
|
||||
@@ -129,3 +129,36 @@ TEST(DefaultRegistry, ViewMultipleComponent) {
|
||||
ASSERT_NO_THROW((registry.view<int, char>().begin()++));
|
||||
ASSERT_NO_THROW((++registry.view<int, char>().begin()));
|
||||
}
|
||||
|
||||
TEST(DefaultRegistry, EmptyViewSingleComponent) {
|
||||
using registry_type = entt::DefaultRegistry<char, int, double>;
|
||||
|
||||
registry_type registry;
|
||||
|
||||
registry.create<char, double>();
|
||||
registry.create<char>();
|
||||
|
||||
auto view = registry.view<int>();
|
||||
|
||||
ASSERT_EQ(view.size(), registry_type::size_type{0});
|
||||
|
||||
registry.reset();
|
||||
}
|
||||
|
||||
TEST(DefaultRegistry, EmptyViewMultipleComponent) {
|
||||
using registry_type = entt::DefaultRegistry<char, int, float, double>;
|
||||
|
||||
registry_type registry;
|
||||
|
||||
registry.create<double, int, float>();
|
||||
registry.create<char, float>();
|
||||
|
||||
auto view = registry.view<char, int, float>();
|
||||
|
||||
for(auto entity: view) {
|
||||
(void)entity;
|
||||
FAIL();
|
||||
}
|
||||
|
||||
registry.reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user