|
|
@@ -3,6 +3,7 @@
|
|
|
#include <vector>
|
|
|
#include <cereal/archives/json.hpp>
|
|
|
#include <entt/entity/registry.hpp>
|
|
|
+#include <entt/entity/helper.hpp>
|
|
|
|
|
|
struct position {
|
|
|
float x;
|
|
|
@@ -52,6 +53,7 @@ TEST(Snapshot, Full) {
|
|
|
|
|
|
auto e3 = source.create();
|
|
|
source.assign<timer>(e3, 1000, 100);
|
|
|
+ source.assign<entt::tag<"empty"_hs>>(e3);
|
|
|
|
|
|
source.destroy(e2);
|
|
|
auto v2 = source.current(e2);
|
|
|
@@ -60,12 +62,12 @@ TEST(Snapshot, Full) {
|
|
|
// output finishes flushing its contents when it goes out of scope
|
|
|
cereal::JSONOutputArchive output{storage};
|
|
|
source.snapshot().entities(output).destroyed(output)
|
|
|
- .component<position, timer, relationship>(output);
|
|
|
+ .component<position, timer, relationship, entt::tag<"empty"_hs>>(output);
|
|
|
}
|
|
|
|
|
|
cereal::JSONInputArchive input{storage};
|
|
|
destination.loader().entities(input).destroyed(input)
|
|
|
- .component<position, timer, relationship>(input);
|
|
|
+ .component<position, timer, relationship, entt::tag<"empty"_hs>>(input);
|
|
|
|
|
|
ASSERT_TRUE(destination.valid(e0));
|
|
|
ASSERT_TRUE(destination.has<position>(e0));
|
|
|
@@ -84,6 +86,7 @@ TEST(Snapshot, Full) {
|
|
|
|
|
|
ASSERT_TRUE(destination.valid(e3));
|
|
|
ASSERT_TRUE(destination.has<timer>(e3));
|
|
|
+ ASSERT_TRUE(destination.has<entt::tag<"empty"_hs>>(e3));
|
|
|
ASSERT_EQ(destination.get<timer>(e3).duration, 1000);
|
|
|
ASSERT_EQ(destination.get<timer>(e3).elapsed, 0);
|
|
|
}
|
|
|
@@ -118,18 +121,19 @@ TEST(Snapshot, Continuous) {
|
|
|
auto e3 = source.create();
|
|
|
source.assign<timer>(e3, 1000, 1000);
|
|
|
source.assign<relationship>(e3, e2);
|
|
|
+ source.assign<entt::tag<"empty"_hs>>(e3);
|
|
|
|
|
|
{
|
|
|
// output finishes flushing its contents when it goes out of scope
|
|
|
cereal::JSONOutputArchive output{storage};
|
|
|
- source.snapshot().entities(output).component<position, relationship, timer>(output);
|
|
|
+ source.snapshot().entities(output).component<position, relationship, timer, entt::tag<"empty"_hs>>(output);
|
|
|
}
|
|
|
|
|
|
cereal::JSONInputArchive input{storage};
|
|
|
entt::continuous_loader loader{destination};
|
|
|
loader.entities(input)
|
|
|
.component<position, relationship>(input, &relationship::parent)
|
|
|
- .component<timer>(input);
|
|
|
+ .component<timer, entt::tag<"empty"_hs>>(input);
|
|
|
|
|
|
ASSERT_FALSE(destination.valid(e0));
|
|
|
ASSERT_TRUE(loader.has(e0));
|
|
|
@@ -178,4 +182,5 @@ TEST(Snapshot, Continuous) {
|
|
|
ASSERT_EQ(destination.get<timer>(l3).elapsed, 0);
|
|
|
ASSERT_TRUE(destination.has<relationship>(l3));
|
|
|
ASSERT_EQ(destination.get<relationship>(l3).parent, l2);
|
|
|
+ ASSERT_TRUE(destination.has<entt::tag<"empty"_hs>>(l3));
|
|
|
}
|