From 018a451051669506be447aa925ecb6a9f5aaf418 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Wed, 4 Dec 2024 20:49:37 +0100 Subject: make format --- src/crepe/api/LoopManager.cpp | 1 - src/crepe/api/Rigidbody.h | 1 - src/crepe/system/CollisionSystem.cpp | 23 +++++++++++++---------- src/crepe/system/CollisionSystem.h | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index d4819ea..478c8ba 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -1,6 +1,5 @@ #include "../facade/SDLContext.h" -#include "../system/PhysicsSystem.h" #include "../system/AnimatorSystem.h" #include "../system/CollisionSystem.h" #include "../system/ParticleSystem.h" diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h index 5c9f6df..293b1a4 100644 --- a/src/crepe/api/Rigidbody.h +++ b/src/crepe/api/Rigidbody.h @@ -139,7 +139,6 @@ public: * collisions with other GameObjects that belong to these layers. */ std::vector collision_layers; - }; public: diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp index 3c103e9..e3b2eca 100644 --- a/src/crepe/system/CollisionSystem.cpp +++ b/src/crepe/system/CollisionSystem.cpp @@ -359,7 +359,9 @@ CollisionSystem::gather_collisions(std::vector & colliders) { for (size_t i = 0; i < colliders.size(); ++i) { for (size_t j = i + 1; j < colliders.size(); ++j) { if (colliders[i].id == colliders[j].id) continue; - if(!have_common_layer(colliders[i].rigidbody.data.collision_layers,colliders[j].rigidbody.data.collision_layers)) continue; + if (!have_common_layer(colliders[i].rigidbody.data.collision_layers, + colliders[j].rigidbody.data.collision_layers)) + continue; CollisionInternalType type = get_collider_type(colliders[i].collider, colliders[j].collider); if (!get_collision( @@ -382,15 +384,16 @@ CollisionSystem::gather_collisions(std::vector & colliders) { return collisions_ret; } -bool CollisionSystem::have_common_layer(const std::vector& layers1, const std::vector& layers2) { - // Iterate through each layer in the first vector - for (int layer : layers1) { - // Check if the current layer is present in the second vector - if (std::find(layers2.begin(), layers2.end(), layer) != layers2.end()) { - return true; // Common layer found - } - } - return false; // No common layers found +bool CollisionSystem::have_common_layer(const std::vector & layers1, + const std::vector & layers2) { + // Iterate through each layer in the first vector + for (int layer : layers1) { + // Check if the current layer is present in the second vector + if (std::find(layers2.begin(), layers2.end(), layer) != layers2.end()) { + return true; // Common layer found + } + } + return false; // No common layers found } CollisionSystem::CollisionInternalType diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h index a22baf2..eb361b8 100644 --- a/src/crepe/system/CollisionSystem.h +++ b/src/crepe/system/CollisionSystem.h @@ -228,7 +228,7 @@ private: * \return Returns true if there is at least one common layer, false otherwise. */ - bool have_common_layer(const std::vector& layers1, const std::vector& layers2); + bool have_common_layer(const std::vector & layers1, const std::vector & layers2); /** * \brief Checks for collision between two colliders. -- cgit v1.2.3