From 39a15bef12411f48673fd506e5e39568c55875ee Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 11 May 2020 14:08:20 +0200 Subject: [PATCH] snapshot: removed deprecated functions --- src/entt/entity/snapshot.hpp | 33 ---------------- test/entt/entity/snapshot.cpp | 71 +++++++---------------------------- test/snapshot/snapshot.cpp | 14 +++---- 3 files changed, 19 insertions(+), 99 deletions(-) diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index 5ecdb2f19..33c790a2e 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -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 - [[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 - [[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 - [[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. diff --git a/test/entt/entity/snapshot.cpp b/test/entt/entity/snapshot.cpp index 3a7dd7da2..cc67b4556 100644 --- a/test/entt/entity/snapshot.cpp +++ b/test/entt/entity/snapshot.cpp @@ -98,11 +98,7 @@ TEST(Snapshot, Dump) { output_archive output{storage}; input_archive input{storage}; - entt::snapshot{registry} - .entities(output) - .destroyed(output) - .component(output); - + entt::snapshot{registry}.entities(output).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(input) - .orphans(); + entt::snapshot_loader{registry}.entities(input).component(input).orphans(); ASSERT_TRUE(registry.valid(e0)); ASSERT_FALSE(registry.valid(e1)); @@ -169,11 +161,7 @@ TEST(Snapshot, Partial) { output_archive output{storage}; input_archive input{storage}; - entt::snapshot{registry} - .entities(output) - .destroyed(output) - .component(output); - + entt::snapshot{registry}.entities(output).component(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(input); + entt::snapshot_loader{registry}.entities(input).component(input); ASSERT_TRUE(registry.valid(e0)); ASSERT_FALSE(registry.valid(e1)); @@ -198,10 +183,7 @@ TEST(Snapshot, Partial) { ASSERT_EQ(registry.get(e2), 3); ASSERT_EQ(registry.get(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(entity); dst.assign(entity, -1, -1); - entt::snapshot{src} - .entities(output) - .destroyed(output) - .component(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .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(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .component( input, &what_a_component::bar, @@ -415,13 +386,9 @@ TEST(Snapshot, Continuous) { component.bar = entity; }); - entt::snapshot{src} - .entities(output) - .destroyed(output) - .component(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .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(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .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_cnt = src.size(); - entt::snapshot{src} - .entities(output) - .destroyed(output) - .component(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .component( input, &what_a_component::bar, @@ -495,13 +454,9 @@ TEST(Snapshot, Continuous) { src.clear(); a_component_cnt = {}; - entt::snapshot{src} - .entities(output) - .destroyed(output) - .component(output); + entt::snapshot{src}.entities(output).component(output); loader.entities(input) - .destroyed(input) .component( input, &what_a_component::bar, diff --git a/test/snapshot/snapshot.cpp b/test/snapshot/snapshot.cpp index c82e08dda..f5d42ac68 100644 --- a/test/snapshot/snapshot.cpp +++ b/test/snapshot/snapshot.cpp @@ -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>(output); + entt::snapshot{source}.entities(output).component>(output); } cereal::JSONInputArchive input{storage}; - entt::snapshot_loader{destination}.entities(input).destroyed(input) - .component>(input); + entt::snapshot_loader{destination}.entities(input).component>(input); ASSERT_TRUE(destination.valid(e0)); ASSERT_TRUE(destination.has(e0)); @@ -137,7 +135,7 @@ TEST(Snapshot, Continuous) { .component>(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(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(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(l2).parent, l0); ASSERT_FALSE(destination.valid(e3)); - ASSERT_TRUE(loader.has(e3)); + ASSERT_TRUE(loader.contains(e3)); auto l3 = loader.map(e3);