From f89fe5f1a44cd0cfc276ba4378222225a3238fd1 Mon Sep 17 00:00:00 2001 From: Ricardo Antunes Date: Wed, 24 Jan 2024 19:37:48 +0000 Subject: [PATCH] style: follow clang-tidy suggestions --- core/src/cubos/core/ecs/world.cpp | 7 ++++--- core/tests/ecs/world.cpp | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/cubos/core/ecs/world.cpp b/core/src/cubos/core/ecs/world.cpp index fc2a8012a..f90387269 100644 --- a/core/src/cubos/core/ecs/world.cpp +++ b/core/src/cubos/core/ecs/world.cpp @@ -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. @@ -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. @@ -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); } diff --git a/core/tests/ecs/world.cpp b/core/tests/ecs/world.cpp index 1337249d0..a503c45db 100644 --- a/core/tests/ecs/world.cpp +++ b/core/tests/ecs/world.cpp @@ -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{}; @@ -337,3 +338,4 @@ TEST_CASE("ecs::World") REQUIRE(destroyed); } } +// NOLINTEND(readability-function-size)