Skip to content

Commit

Permalink
Tweaked: query_sort_cond makes use of SortComponentCond
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbiely committed Oct 2, 2024
1 parent a19698c commit 41a25c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/gaia/ecs/query_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace gaia {

// Smaller ids second.
if (lhs.id != rhs.id)
return lhs.id < rhs.id;
return SortComponentCond()(lhs.id, rhs.id);

// Sources go last. Note, sources are never a pair.
// We want to do it this way because it would be expensive to build cache for
Expand All @@ -223,7 +223,7 @@ namespace gaia {
// E.g. depending on the number of archetypes we'd have to traverse
// it might be beneficial to do a different ordering which is impossible
// to do at this point.
return lhs.src.id() < rhs.src.id();
return SortComponentCond()(lhs.src, rhs.src);
}
};

Expand Down
8 changes: 4 additions & 4 deletions include/gaia/ecs/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ namespace gaia {
inline void match_archetype_one(MatchingCtx& ctx) {
EntityLookupKey entityKey(ctx.ent);

// For ANY we need at least one archetypes to match.
// For ANY we need at least one archetype to match.
// However, because any of them can match, we need to check them all.
// Iterating all of them is caller's responsibility.
const auto* pArchetypes = fetch_archetypes_for_select(*ctx.pEntityToArchetypeMap, entityKey);
Expand All @@ -529,7 +529,7 @@ namespace gaia {
inline void match_archetype_one_as(MatchingCtx& ctx) {
const auto& allArchetypes = *ctx.pAllArchetypes;

// For ANY we need at least one archetypes to match.
// For ANY we need at least one archetype to match.
// However, because any of them can match, we need to check them all.
// Iterating all of them is caller's responsibility.

Expand Down Expand Up @@ -565,7 +565,7 @@ namespace gaia {

inline void match_archetype_no_2(MatchingCtx& ctx) {
// We had some matches already (with ALL or ANY). We need to remove those
// that match with the NO list. Remove them back-to-front.
// that match with the NO list.
for (uint32_t i = 0; i < ctx.pMatchesArr->size();) {
auto* pArchetype = (*ctx.pMatchesArr)[i];
if (match_res<OpNo>(*pArchetype, ctx.idsToMatch)) {
Expand All @@ -579,7 +579,7 @@ namespace gaia {

inline void match_archetype_no_as_2(MatchingCtx& ctx) {
// We had some matches already (with ALL or ANY). We need to remove those
// that match with the NO list. Remove them back-to-front.
// that match with the NO list.
for (uint32_t i = 0; i < ctx.pMatchesArr->size();) {
auto* pArchetype = (*ctx.pMatchesArr)[i];
if (match_res_as<OpNo>(*ctx.pWorld, *pArchetype, ctx.idsToMatch)) {
Expand Down
12 changes: 6 additions & 6 deletions single_include/gaia.h
Original file line number Diff line number Diff line change
Expand Up @@ -21583,7 +21583,7 @@ namespace gaia {

// Smaller ids second.
if (lhs.id != rhs.id)
return lhs.id < rhs.id;
return SortComponentCond()(lhs.id, rhs.id);

// Sources go last. Note, sources are never a pair.
// We want to do it this way because it would be expensive to build cache for
Expand All @@ -21593,7 +21593,7 @@ namespace gaia {
// E.g. depending on the number of archetypes we'd have to traverse
// it might be beneficial to do a different ordering which is impossible
// to do at this point.
return lhs.src.id() < rhs.src.id();
return SortComponentCond()(lhs.src, rhs.src);
}
};

Expand Down Expand Up @@ -22571,7 +22571,7 @@ namespace gaia {
inline void match_archetype_one(MatchingCtx& ctx) {
EntityLookupKey entityKey(ctx.ent);

// For ANY we need at least one archetypes to match.
// For ANY we need at least one archetype to match.
// However, because any of them can match, we need to check them all.
// Iterating all of them is caller's responsibility.
const auto* pArchetypes = fetch_archetypes_for_select(*ctx.pEntityToArchetypeMap, entityKey);
Expand All @@ -22584,7 +22584,7 @@ namespace gaia {
inline void match_archetype_one_as(MatchingCtx& ctx) {
const auto& allArchetypes = *ctx.pAllArchetypes;

// For ANY we need at least one archetypes to match.
// For ANY we need at least one archetype to match.
// However, because any of them can match, we need to check them all.
// Iterating all of them is caller's responsibility.

Expand Down Expand Up @@ -22620,7 +22620,7 @@ namespace gaia {

inline void match_archetype_no_2(MatchingCtx& ctx) {
// We had some matches already (with ALL or ANY). We need to remove those
// that match with the NO list. Remove them back-to-front.
// that match with the NO list.
for (uint32_t i = 0; i < ctx.pMatchesArr->size();) {
auto* pArchetype = (*ctx.pMatchesArr)[i];
if (match_res<OpNo>(*pArchetype, ctx.idsToMatch)) {
Expand All @@ -22634,7 +22634,7 @@ namespace gaia {

inline void match_archetype_no_as_2(MatchingCtx& ctx) {
// We had some matches already (with ALL or ANY). We need to remove those
// that match with the NO list. Remove them back-to-front.
// that match with the NO list.
for (uint32_t i = 0; i < ctx.pMatchesArr->size();) {
auto* pArchetype = (*ctx.pMatchesArr)[i];
if (match_res_as<OpNo>(*ctx.pWorld, *pArchetype, ctx.idsToMatch)) {
Expand Down

0 comments on commit 41a25c5

Please sign in to comment.