Browse Source

fixed group::sort with components

Michele Caini 6 years ago
parent
commit
c4d78c06eb
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/entt/entity/group.hpp

+ 2 - 2
src/entt/entity/group.hpp

@@ -806,9 +806,9 @@ public:
                 return compare(data[lhs], data[rhs]);
                 return compare(data[lhs], data[rhs]);
             }, std::forward<Args>(args)...);
             }, std::forward<Args>(args)...);
         } else {
         } else {
-            algo(copy.rbegin(), copy.rend(), [compare = std::move(compare), this](const auto lhs, const auto rhs) {
+            algo(copy.rbegin(), copy.rend(), [compare = std::move(compare), data = data(), this](const auto lhs, const auto rhs) {
                 // useless this-> used to suppress a warning with clang
                 // useless this-> used to suppress a warning with clang
-                return compare(this->get<Component>(lhs)..., this->get<Component>(rhs)...);
+                return compare(this->get<Component>(data[lhs])..., this->get<Component>(data[rhs])...);
             }, std::forward<Args>(args)...);
             }, std::forward<Args>(args)...);
         }
         }