Compare commits
No commits in common. "72f635400a2022b2fc57ac5f1b159565891929ad" and "cb05c2cf1ddce52b930ee1a7adb2d611d0a32a77" have entirely different histories.
72f635400a
...
cb05c2cf1d
2 changed files with 4 additions and 39 deletions
|
@ -473,40 +473,12 @@ TEST_CASE("Archetype signature management")
|
||||||
// Initial state: empty archetype
|
// Initial state: empty archetype
|
||||||
REQUIRE(w.archetype_count() == 0);
|
REQUIRE(w.archetype_count() == 0);
|
||||||
|
|
||||||
auto e0 = w.make_entity();
|
auto e = w.make_entity();
|
||||||
REQUIRE(w.archetype_count() == 1); //<>
|
REQUIRE(w.archetype_count() == 1);
|
||||||
|
|
||||||
// Add first component
|
// Add first component
|
||||||
w.set<A>(e0);
|
w.set<A>(e);
|
||||||
REQUIRE(w.archetype_count() == 1); //<A>
|
REQUIRE(w.archetype_count() == 1);
|
||||||
|
|
||||||
w.set<B>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 1); //<A, B>
|
|
||||||
|
|
||||||
w.set<C>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 1); //<A, B, C>
|
|
||||||
|
|
||||||
w.remove<A, B>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 1); //<C>
|
|
||||||
|
|
||||||
auto e1 = w.make_entity();
|
|
||||||
w.set<A, B>(e1);
|
|
||||||
REQUIRE(w.archetype_count() == 2); //<C>, <A, B>
|
|
||||||
|
|
||||||
w.remove<C>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 2); //<>, <A, B>
|
|
||||||
|
|
||||||
w.set<A>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 2); //<A>, <A, B>
|
|
||||||
|
|
||||||
w.set<B>(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 1); //<A, B>
|
|
||||||
|
|
||||||
w.destroy_entity(e0);
|
|
||||||
REQUIRE(w.archetype_count() == 1); //<A, B>
|
|
||||||
|
|
||||||
w.destroy_entity(e1);
|
|
||||||
REQUIRE(w.archetype_count() == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Component distribution across archetypes")
|
TEST_CASE("Component distribution across archetypes")
|
||||||
|
@ -527,13 +499,11 @@ TEST_CASE("Component distribution across archetypes")
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set<A>(e);
|
w.set<A>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 3; ++i)
|
for(int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set<A, B>(e);
|
w.set<A, B>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 2; ++i)
|
for(int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
|
|
|
@ -319,11 +319,6 @@ namespace zecsy
|
||||||
|
|
||||||
archetypes[new_key].emplace_back(e);
|
archetypes[new_key].emplace_back(e);
|
||||||
|
|
||||||
if(archetypes[old_key].empty())
|
|
||||||
{
|
|
||||||
archetypes.erase(old_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& pool = pools[id];
|
auto& pool = pools[id];
|
||||||
auto index = pool.entity_to_index[e];
|
auto index = pool.entity_to_index[e];
|
||||||
pool.free_list.push_back(index);
|
pool.free_list.push_back(index);
|
||||||
|
|
Loading…
Reference in a new issue