Skip to content

Commit

Permalink
Fixed: ecs::pair would not be able to discern gen & uni entities
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbiely committed Feb 2, 2024
1 parent 254abed commit 5b8efde
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion include/gaia/ecs/id.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,15 @@ namespace gaia {
pair(Entity a, Entity b) noexcept: m_first(a), m_second(b) {}

operator Entity() const noexcept {
return Entity(m_first.id(), m_second.id(), false, true, EntityKind::EK_Gen);
return Entity(
m_first.id(), m_second.id(),
// Pairs have no way of telling gen and uni entities apart.
// Therefore, for first, we use the entity bit as Gen/Uni...
(bool)m_first.kind(),
// Always true for pairs
true,
// ... and for second, we use the kind bit.
m_second.kind());
}

Entity first() const noexcept {
Expand Down

0 comments on commit 5b8efde

Please sign in to comment.