Explorar el Código

snapshot: avoid unnecessary lookups

Michele Caini hace 3 años
padre
commit
1f93ea4eee
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/entt/entity/snapshot.hpp

+ 2 - 1
src/entt/entity/snapshot.hpp

@@ -505,6 +505,7 @@ public:
      * @return A non-const reference to this loader.
      * @return A non-const reference to this loader.
      */
      */
     basic_continuous_loader &shrink() {
     basic_continuous_loader &shrink() {
+        const auto &storage = reg->template storage<entity_type>();
         auto it = remloc.begin();
         auto it = remloc.begin();
 
 
         while(it != remloc.cend()) {
         while(it != remloc.cend()) {
@@ -515,7 +516,7 @@ public:
                 dirty = false;
                 dirty = false;
                 ++it;
                 ++it;
             } else {
             } else {
-                if(reg->valid(local)) {
+                if(storage.contains(local)) {
                     reg->destroy(local);
                     reg->destroy(local);
                 }
                 }