1
0
Эх сурвалжийг харах

snapshot: review ::orphans functions

Michele Caini 3 жил өмнө
parent
commit
295c68841c

+ 10 - 6
src/entt/entity/snapshot.hpp

@@ -265,11 +265,13 @@ public:
      * @return A valid loader to continue restoring data.
      * @return A valid loader to continue restoring data.
      */
      */
     const basic_snapshot_loader &orphans() const {
     const basic_snapshot_loader &orphans() const {
-        reg->each([this](const auto entt) {
+        auto &entities = reg->template storage<entity_type>();
+
+        for(auto entt: entities) {
             if(reg->orphan(entt)) {
             if(reg->orphan(entt)) {
-                reg->release(entt);
+                entities.erase(entt);
             }
             }
-        });
+        }
 
 
         return *this;
         return *this;
     }
     }
@@ -523,11 +525,13 @@ public:
      * @return A non-const reference to this loader.
      * @return A non-const reference to this loader.
      */
      */
     basic_continuous_loader &orphans() {
     basic_continuous_loader &orphans() {
-        reg->each([this](const auto entt) {
+        auto &entities = reg->template storage<entity_type>();
+
+        for(auto entt: entities) {
             if(reg->orphan(entt)) {
             if(reg->orphan(entt)) {
-                reg->release(entt);
+                entities.erase(entt);
             }
             }
-        });
+        }
 
 
         return *this;
         return *this;
     }
     }