Просмотр исходного кода

range stomp is now named stomp_each for consistency

Michele Caini 6 лет назад
Родитель
Сommit
c380da7214
4 измененных файлов с 12 добавлено и 13 удалено
  1. 0 1
      TODO
  2. 7 7
      docs/md/entity.md
  3. 3 3
      src/entt/entity/registry.hpp
  4. 2 2
      test/entt/entity/registry.cpp

+ 0 - 1
TODO

@@ -38,6 +38,5 @@
 * meta: are fake types not backed by actual types possible?
 * 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
 * named types: almost-stable index optimization for direct access to pools, no more linear searches
 * multi component registry::remove and some others?
 * multi component registry::remove and some others?
-  - range stomp -> stomp_each
   - remove create overload for spwaning
   - remove create overload for spwaning
   - clean up stomp functions
   - clean up stomp functions

+ 7 - 7
docs/md/entity.md

@@ -688,13 +688,13 @@ nothing more than a container and different optimizations and strategies can be
 applied to different containers.
 applied to different containers.
 
 
 Once there are multiple registries available, however, one or more methods are
 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 .<br/>
-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 .<br/>
+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
 These features open definitely the doors to a lot of interesting features like
 migrating entities between registries, prototypes, shadow registry, prefabs,
 migrating entities between registries, prototypes, shadow registry, prefabs,

+ 3 - 3
src/entt/entity/registry.hpp

@@ -650,7 +650,7 @@ public:
         create(first, last);
         create(first, last);
 
 
         if constexpr(sizeof...(Component) == 0) {
         if constexpr(sizeof...(Component) == 0) {
-            stomp<Component...>(first, last, src, other, exclude<Exclude...>);
+            stomp_each<Component...>(first, last, src, other, exclude<Exclude...>);
         } else {
         } else {
             static_assert(sizeof...(Exclude) == 0);
             static_assert(sizeof...(Exclude) == 0);
             (assure<Component>()->batch(*this, first, last, other.get<Component>(src)), ...);
             (assure<Component>()->batch(*this, first, last, other.get<Component>(src)), ...);
@@ -1639,7 +1639,7 @@ public:
     template<typename... Component, typename... Exclude>
     template<typename... Component, typename... Exclude>
     void stomp(const entity_type dst, const entity_type src, const basic_registry &other, exclude_t<Exclude...> = {}) {
     void stomp(const entity_type dst, const entity_type src, const basic_registry &other, exclude_t<Exclude...> = {}) {
         const entity_type entt[1]{dst};
         const entity_type entt[1]{dst};
-        stomp<Component...>(std::begin(entt), std::end(entt), src, other, exclude<Exclude...>);
+        stomp_each<Component...>(std::begin(entt), std::end(entt), src, other, exclude<Exclude...>);
     }
     }
 
 
     /**
     /**
@@ -1656,7 +1656,7 @@ public:
      * @param other The registry that owns the source entity.
      * @param other The registry that owns the source entity.
      */
      */
     template<typename... Component, typename It, typename... Exclude>
     template<typename... Component, typename It, typename... Exclude>
-    void stomp(It first, It last, const entity_type src, const basic_registry &other, exclude_t<Exclude...> = {}) {
+    void stomp_each(It first, It last, const entity_type src, const basic_registry &other, exclude_t<Exclude...> = {}) {
         static_assert(sizeof...(Component) == 0 || sizeof...(Exclude) == 0);
         static_assert(sizeof...(Component) == 0 || sizeof...(Exclude) == 0);
 
 
         for(auto pos = other.pools.size(); pos; --pos) {
         for(auto pos = other.pools.size(); pos; --pos) {

+ 2 - 2
test/entt/entity/registry.cpp

@@ -1571,7 +1571,7 @@ TEST(Registry, StompMulti) {
 
 
     entt::entity entities[2];
     entt::entity entities[2];
     registry.create(std::begin(entities), std::end(entities));
     registry.create(std::begin(entities), std::end(entities));
-    registry.stomp<int, char, double>(std::begin(entities), std::end(entities), prototype, registry);
+    registry.stomp_each<int, char, double>(std::begin(entities), std::end(entities), prototype, registry);
 
 
     ASSERT_TRUE((registry.has<int, char>(entities[0])));
     ASSERT_TRUE((registry.has<int, char>(entities[0])));
     ASSERT_TRUE((registry.has<int, char>(entities[1])));
     ASSERT_TRUE((registry.has<int, char>(entities[1])));
@@ -1588,7 +1588,7 @@ TEST(Registry, StompExcludeMulti) {
 
 
     entt::entity entities[2];
     entt::entity entities[2];
     registry.create(std::begin(entities), std::end(entities));
     registry.create(std::begin(entities), std::end(entities));
-    registry.stomp(std::begin(entities), std::end(entities), prototype, registry, entt::exclude<char>);
+    registry.stomp_each(std::begin(entities), std::end(entities), prototype, registry, entt::exclude<char>);
 
 
     ASSERT_TRUE((registry.has<int>(entities[0])));
     ASSERT_TRUE((registry.has<int>(entities[0])));
     ASSERT_TRUE((registry.has<int>(entities[1])));
     ASSERT_TRUE((registry.has<int>(entities[1])));