snapshot: removed deprecated functions

This commit is contained in:
Michele Caini
2020-05-11 14:08:20 +02:00
parent 92c59f3ea1
commit 39a15bef12
3 changed files with 19 additions and 99 deletions

View File

@@ -107,15 +107,6 @@ public:
return *this;
}
/**
* @brief Deprecated function. Currently, it does nothing.
* @tparam Archive Type of output archive.
* @return An object of this type to continue creating the snapshot.
*/
template<typename Archive>
[[deprecated("use ::entities instead, it exports now also destroyed entities")]]
const basic_snapshot & destroyed(Archive &) const { return *this; }
/**
* @brief Puts aside the given components.
*
@@ -245,15 +236,6 @@ public:
return *this;
}
/**
* @brief Deprecated function. Currently, it does nothing.
* @tparam Archive Type of input archive.
* @return A valid loader to continue restoring data.
*/
template<typename Archive>
[[deprecated("use ::entities instead, it imports now also destroyed entities")]]
const basic_snapshot_loader & destroyed(Archive &) const { return *this; }
/**
* @brief Restores components and assigns them to the right entities.
*
@@ -466,15 +448,6 @@ public:
return *this;
}
/**
* @brief Deprecated function. Currently, it does nothing.
* @tparam Archive Type of input archive.
* @return A non-const reference to this loader.
*/
template<typename Archive>
[[deprecated("use ::entities instead, it imports now also destroyed entities")]]
basic_continuous_loader & destroyed(Archive &) { return *this; }
/**
* @brief Restores components and assigns them to the right entities.
*
@@ -558,12 +531,6 @@ public:
return (remloc.find(entt) != remloc.cend());
}
/*! @copydoc contains */
[[deprecated("use ::contains instead")]]
bool has(entity_type entt) const ENTT_NOEXCEPT {
return contains(entt);
}
/**
* @brief Returns the identifier to which an entity refers.
* @param entt An entity identifier.

View File

@@ -98,11 +98,7 @@ TEST(Snapshot, Dump) {
output_archive<storage_type> output{storage};
input_archive<storage_type> input{storage};
entt::snapshot{registry}
.entities(output)
.destroyed(output)
.component<int, char, double, a_component, another_component>(output);
entt::snapshot{registry}.entities(output).component<int, char, double, a_component, another_component>(output);
registry.clear();
ASSERT_FALSE(registry.valid(e0));
@@ -110,11 +106,7 @@ TEST(Snapshot, Dump) {
ASSERT_FALSE(registry.valid(e2));
ASSERT_FALSE(registry.valid(e3));
entt::snapshot_loader{registry}
.entities(input)
.destroyed(input)
.component<int, char, double, a_component, another_component>(input)
.orphans();
entt::snapshot_loader{registry}.entities(input).component<int, char, double, a_component, another_component>(input).orphans();
ASSERT_TRUE(registry.valid(e0));
ASSERT_FALSE(registry.valid(e1));
@@ -169,11 +161,7 @@ TEST(Snapshot, Partial) {
output_archive<storage_type> output{storage};
input_archive<storage_type> input{storage};
entt::snapshot{registry}
.entities(output)
.destroyed(output)
.component<char, int>(output);
entt::snapshot{registry}.entities(output).component<char, int>(output);
registry.clear();
ASSERT_FALSE(registry.valid(e0));
@@ -181,10 +169,7 @@ TEST(Snapshot, Partial) {
ASSERT_FALSE(registry.valid(e2));
ASSERT_FALSE(registry.valid(e3));
entt::snapshot_loader{registry}
.entities(input)
.destroyed(input)
.component<char, int>(input);
entt::snapshot_loader{registry}.entities(input).component<char, int>(input);
ASSERT_TRUE(registry.valid(e0));
ASSERT_FALSE(registry.valid(e1));
@@ -198,10 +183,7 @@ TEST(Snapshot, Partial) {
ASSERT_EQ(registry.get<int>(e2), 3);
ASSERT_EQ(registry.get<char>(e3), '0');
entt::snapshot{registry}
.entities(output)
.destroyed(output);
entt::snapshot{registry}.entities(output);
registry.clear();
ASSERT_FALSE(registry.valid(e0));
@@ -209,10 +191,7 @@ TEST(Snapshot, Partial) {
ASSERT_FALSE(registry.valid(e2));
ASSERT_FALSE(registry.valid(e3));
entt::snapshot_loader{registry}
.entities(input)
.destroyed(input)
.orphans();
entt::snapshot_loader{registry}.entities(input).orphans();
ASSERT_FALSE(registry.valid(e0));
ASSERT_FALSE(registry.valid(e1));
@@ -318,13 +297,9 @@ TEST(Snapshot, Continuous) {
dst.assign<a_component>(entity);
dst.assign<another_component>(entity, -1, -1);
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<a_component, another_component, what_a_component, map_component>(output);
entt::snapshot{src}.entities(output).component<a_component, another_component, what_a_component, map_component>(output);
loader.entities(input)
.destroyed(input)
.component<a_component, another_component, what_a_component, map_component>(
input,
&what_a_component::bar,
@@ -382,13 +357,9 @@ TEST(Snapshot, Continuous) {
auto size = dst.size();
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<a_component, what_a_component, map_component, another_component>(output);
entt::snapshot{src}.entities(output).component<a_component, what_a_component, map_component, another_component>(output);
loader.entities(input)
.destroyed(input)
.component<a_component, what_a_component, map_component, another_component>(
input,
&what_a_component::bar,
@@ -415,13 +386,9 @@ TEST(Snapshot, Continuous) {
component.bar = entity;
});
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<what_a_component, map_component, a_component, another_component>(output);
entt::snapshot{src}.entities(output).component<what_a_component, map_component, a_component, another_component>(output);
loader.entities(input)
.destroyed(input)
.component<what_a_component, map_component, a_component, another_component>(
input,
&what_a_component::bar,
@@ -443,13 +410,9 @@ TEST(Snapshot, Continuous) {
src.destroy(entity);
loader.shrink();
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<a_component, another_component, what_a_component, map_component>(output);
entt::snapshot{src}.entities(output).component<a_component, another_component, what_a_component, map_component>(output);
loader.entities(input)
.destroyed(input)
.component<a_component, another_component, what_a_component, map_component>(
input,
&what_a_component::bar,
@@ -463,7 +426,7 @@ TEST(Snapshot, Continuous) {
ASSERT_FALSE(dst.valid(component.bar));
});
ASSERT_FALSE(loader.has(entity));
ASSERT_FALSE(loader.contains(entity));
entity = src.create();
@@ -474,13 +437,9 @@ TEST(Snapshot, Continuous) {
dst.clear<a_component>();
a_component_cnt = src.size<a_component>();
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<a_component, what_a_component, map_component, another_component>(output);
entt::snapshot{src}.entities(output).component<a_component, what_a_component, map_component, another_component>(output);
loader.entities(input)
.destroyed(input)
.component<a_component, what_a_component, map_component, another_component>(
input,
&what_a_component::bar,
@@ -495,13 +454,9 @@ TEST(Snapshot, Continuous) {
src.clear<a_component>();
a_component_cnt = {};
entt::snapshot{src}
.entities(output)
.destroyed(output)
.component<what_a_component, map_component, a_component, another_component>(output);
entt::snapshot{src}.entities(output).component<what_a_component, map_component, a_component, another_component>(output);
loader.entities(input)
.destroyed(input)
.component<what_a_component, map_component, a_component, another_component>(
input,
&what_a_component::bar,

View File

@@ -62,13 +62,11 @@ TEST(Snapshot, Full) {
{
// output finishes flushing its contents when it goes out of scope
cereal::JSONOutputArchive output{storage};
entt::snapshot{source}.entities(output).destroyed(output)
.component<position, timer, relationship, entt::tag<"empty"_hs>>(output);
entt::snapshot{source}.entities(output).component<position, timer, relationship, entt::tag<"empty"_hs>>(output);
}
cereal::JSONInputArchive input{storage};
entt::snapshot_loader{destination}.entities(input).destroyed(input)
.component<position, timer, relationship, entt::tag<"empty"_hs>>(input);
entt::snapshot_loader{destination}.entities(input).component<position, timer, relationship, entt::tag<"empty"_hs>>(input);
ASSERT_TRUE(destination.valid(e0));
ASSERT_TRUE(destination.has<position>(e0));
@@ -137,7 +135,7 @@ TEST(Snapshot, Continuous) {
.component<timer, entt::tag<"empty"_hs>>(input);
ASSERT_FALSE(destination.valid(e0));
ASSERT_TRUE(loader.has(e0));
ASSERT_TRUE(loader.contains(e0));
auto l0 = loader.map(e0);
@@ -149,7 +147,7 @@ TEST(Snapshot, Continuous) {
ASSERT_EQ(destination.get<relationship>(l0).parent, l0);
ASSERT_FALSE(destination.valid(e1));
ASSERT_TRUE(loader.has(e1));
ASSERT_TRUE(loader.contains(e1));
auto l1 = loader.map(e1);
@@ -161,7 +159,7 @@ TEST(Snapshot, Continuous) {
ASSERT_EQ(destination.get<relationship>(l1).parent, l0);
ASSERT_FALSE(destination.valid(e2));
ASSERT_TRUE(loader.has(e2));
ASSERT_TRUE(loader.contains(e2));
auto l2 = loader.map(e2);
@@ -173,7 +171,7 @@ TEST(Snapshot, Continuous) {
ASSERT_EQ(destination.get<relationship>(l2).parent, l0);
ASSERT_FALSE(destination.valid(e3));
ASSERT_TRUE(loader.has(e3));
ASSERT_TRUE(loader.contains(e3));
auto l3 = loader.map(e3);