From c380da72144dcdcadc97d738b69ccefe377a526e Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 30 Oct 2019 00:03:42 +0100 Subject: [PATCH] range stomp is now named stomp_each for consistency --- TODO | 1 - docs/md/entity.md | 14 +++++++------- src/entt/entity/registry.hpp | 6 +++--- test/entt/entity/registry.cpp | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index f721f0fec..205ab2d2c 100644 --- a/TODO +++ b/TODO @@ -38,6 +38,5 @@ * meta: are fake types not backed by actual types possible? * named types: almost-stable index optimization for direct access to pools, no more linear searches * multi component registry::remove and some others? - - range stomp -> stomp_each - remove create overload for spwaning - clean up stomp functions diff --git a/docs/md/entity.md b/docs/md/entity.md index ebd2e62a9..52f354fa9 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -688,13 +688,13 @@ nothing more than a container and different optimizations and strategies can be applied to different containers. Once there are multiple registries available, however, one or more methods are -needed to transfer information from one container to another and this results in -the `stomp` member function and a couple of overloads of the `create` member -function for the `registry` class .
-The `stomp` function allows to take one entity from a registry and use it to -_stomp_ one or more entities in another registry (or even the same, actually -making local copies). On the other hand, the overloads of the `create` member -function can be used to spawn new entities from a prototype. +needed to transfer information from one container to another. This results in +the `stomp` and `stomp_each` member functions, other than a couple of overloads +of the `create` member function for the `registry` class .
+These functions allow to take one entity from a registry and use it to _stomp_ +one or more entities in another registry (or even the same, actually making +local copies). On the other hand, the overloads of the `create` member function +can be used to spawn new entities from a prototype. These features open definitely the doors to a lot of interesting features like migrating entities between registries, prototypes, shadow registry, prefabs, diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 3bbfaac96..a9431c164 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -650,7 +650,7 @@ public: create(first, last); if constexpr(sizeof...(Component) == 0) { - stomp(first, last, src, other, exclude); + stomp_each(first, last, src, other, exclude); } else { static_assert(sizeof...(Exclude) == 0); (assure()->batch(*this, first, last, other.get(src)), ...); @@ -1639,7 +1639,7 @@ public: template void stomp(const entity_type dst, const entity_type src, const basic_registry &other, exclude_t = {}) { const entity_type entt[1]{dst}; - stomp(std::begin(entt), std::end(entt), src, other, exclude); + stomp_each(std::begin(entt), std::end(entt), src, other, exclude); } /** @@ -1656,7 +1656,7 @@ public: * @param other The registry that owns the source entity. */ template - void stomp(It first, It last, const entity_type src, const basic_registry &other, exclude_t = {}) { + void stomp_each(It first, It last, const entity_type src, const basic_registry &other, exclude_t = {}) { static_assert(sizeof...(Component) == 0 || sizeof...(Exclude) == 0); for(auto pos = other.pools.size(); pos; --pos) { diff --git a/test/entt/entity/registry.cpp b/test/entt/entity/registry.cpp index fff5e79c3..2fdf2f020 100644 --- a/test/entt/entity/registry.cpp +++ b/test/entt/entity/registry.cpp @@ -1571,7 +1571,7 @@ TEST(Registry, StompMulti) { entt::entity entities[2]; registry.create(std::begin(entities), std::end(entities)); - registry.stomp(std::begin(entities), std::end(entities), prototype, registry); + registry.stomp_each(std::begin(entities), std::end(entities), prototype, registry); ASSERT_TRUE((registry.has(entities[0]))); ASSERT_TRUE((registry.has(entities[1]))); @@ -1588,7 +1588,7 @@ TEST(Registry, StompExcludeMulti) { entt::entity entities[2]; registry.create(std::begin(entities), std::end(entities)); - registry.stomp(std::begin(entities), std::end(entities), prototype, registry, entt::exclude); + registry.stomp_each(std::begin(entities), std::end(entities), prototype, registry, entt::exclude); ASSERT_TRUE((registry.has(entities[0]))); ASSERT_TRUE((registry.has(entities[1])));