Skip to content

Commit

Permalink
style: follow clang-tidy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Jan 24, 2024
1 parent 8639bf5 commit f89fe5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/src/cubos/core/ecs/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void World::relate(Entity from, Entity to, const reflection::Type& type, void* v
{
// TODO: this is a bit expensive at the moment, since we have to iterate over all tables with
// the same from archetype. Maybe we should keep an index to find the tables directly from the entities.
auto& fromTables = mTables.sparseRelation().type(dataType).from();
const auto& fromTables = mTables.sparseRelation().type(dataType).from();

// If the relation is tree-like, then we need to find the depth of the 'to' entity in the tree,
// to figure out which table to insert this relation into.
Expand Down Expand Up @@ -295,7 +295,7 @@ bool World::related(Entity from, Entity to, const reflection::Type& type) const
void World::propagateDepth(uint32_t index, DataTypeId dataType, int depth)
{
auto archetype = mEntityPool.archetype(index);
auto& toTables = mTables.sparseRelation().type(dataType).to();
const auto& toTables = mTables.sparseRelation().type(dataType).to();
if (toTables.contains(archetype))
{
// Collect all tables which contain relations which have the entity as the 'to' entity.
Expand All @@ -321,7 +321,8 @@ void World::propagateDepth(uint32_t index, DataTypeId dataType, int depth)
for (auto row = table.firstTo(index); row != table.size(); row = table.nextTo(row))
{
// Get the 'from' entity and recurse.
uint32_t fromIndex, toIndex;
uint32_t fromIndex;
uint32_t toIndex;
table.indices(row, fromIndex, toIndex);
this->propagateDepth(fromIndex, dataType, depth + 1);
}
Expand Down
2 changes: 2 additions & 0 deletions core/tests/ecs/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using cubos::core::ecs::SparseRelationTableId;
using cubos::core::ecs::World;
using cubos::core::reflection::reflect;

// NOLINTBEGIN(readability-function-size)
TEST_CASE("ecs::World")
{
World world{};
Expand Down Expand Up @@ -337,3 +338,4 @@ TEST_CASE("ecs::World")
REQUIRE(destroyed);
}
}
// NOLINTEND(readability-function-size)

0 comments on commit f89fe5f

Please sign in to comment.