From c6012f1be6e201c44cd0aa93a70d65976b91f096 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 18 May 2021 09:42:18 +0200 Subject: [PATCH] Fixing PR issues --- lib/wal/CMakeLists.txt | 2 +- lib/wal/sources/Component/Component.hpp | 5 +++-- lib/wal/sources/Entity/Entity.hpp | 8 +++++--- lib/wal/sources/Scene/Scene.cpp | 2 +- lib/wal/sources/Scene/Scene.hpp | 2 +- lib/wal/sources/Scene/SceneManager.hpp | 2 +- lib/wal/sources/System/System.hpp | 4 +++- lib/wal/sources/Wal.cpp | 2 +- lib/wal/sources/Wal.hpp | 2 +- 9 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/wal/CMakeLists.txt b/lib/wal/CMakeLists.txt index b10c94d9..2e6dff87 100644 --- a/lib/wal/CMakeLists.txt +++ b/lib/wal/CMakeLists.txt @@ -33,7 +33,7 @@ add_library(wal target_include_directories(wal PUBLIC sources) -add_executable(wal_tests +add_executable(wal_tests EXCLUDE_FROM_ALL tests/EntityTests.cpp tests/MainTest.cpp tests/EngineTests.cpp diff --git a/lib/wal/sources/Component/Component.hpp b/lib/wal/sources/Component/Component.hpp index c05fd507..410a026c 100644 --- a/lib/wal/sources/Component/Component.hpp +++ b/lib/wal/sources/Component/Component.hpp @@ -1,5 +1,6 @@ - - +// +// Created by Zoe Roux on 2021-05-14. +// #pragma once diff --git a/lib/wal/sources/Entity/Entity.hpp b/lib/wal/sources/Entity/Entity.hpp index b8e2e05e..7a902ecd 100644 --- a/lib/wal/sources/Entity/Entity.hpp +++ b/lib/wal/sources/Entity/Entity.hpp @@ -1,4 +1,6 @@ - +// +// Created by Zoe Roux on 2021-05-14. +// #pragma once @@ -44,7 +46,7 @@ namespace WAL T &getComponent() { const std::type_info &type = typeid(T); - auto existing = std::find_if(this->_components.begin(), this->_components.end(), [&type] (auto &cmp) { + auto existing = std::find_if(this->_components.begin(), this->_components.end(), [&type] (const auto &cmp) { return typeid(*cmp) == type; }); if (existing == this->_components.end()) @@ -88,7 +90,7 @@ namespace WAL Entity &removeComponent() { const std::type_info &type = typeid(T); - auto existing =std::find_if(this->_components.begin(), this->_components.end(), [&type] (auto &cmp) { + auto existing = std::find_if(this->_components.begin(), this->_components.end(), [&type] (const auto &cmp) { return typeid(*cmp) == type; }); if (existing == this->_components.end()) diff --git a/lib/wal/sources/Scene/Scene.cpp b/lib/wal/sources/Scene/Scene.cpp index bde3f639..b0a3b3a7 100644 --- a/lib/wal/sources/Scene/Scene.cpp +++ b/lib/wal/sources/Scene/Scene.cpp @@ -8,7 +8,7 @@ namespace WAL { std::vector &Scene::getEntities() { - return this->_entity; + return this->_entities; } } diff --git a/lib/wal/sources/Scene/Scene.hpp b/lib/wal/sources/Scene/Scene.hpp index 29ea2c9a..bf86de44 100644 --- a/lib/wal/sources/Scene/Scene.hpp +++ b/lib/wal/sources/Scene/Scene.hpp @@ -15,7 +15,7 @@ namespace WAL { private: //! @brief The list of registered entities - std::vector _entity; + std::vector _entities; public: //! @brief Get the list of entities. std::vector &getEntities(); diff --git a/lib/wal/sources/Scene/SceneManager.hpp b/lib/wal/sources/Scene/SceneManager.hpp index 21765dc9..16268e75 100644 --- a/lib/wal/sources/Scene/SceneManager.hpp +++ b/lib/wal/sources/Scene/SceneManager.hpp @@ -20,7 +20,7 @@ namespace WAL //! @return The manager instance used to call this function is returned. This allow method chaining. SceneManager &addScene(Scene &&scene); - //! @brief Add a scene before the current scene to allow + //! @brief Add a scene before the current scene. This could be useful for lobbies or scene where the next scene can be constructed. //! @return The manager instance used to call this function is returned. This allow method chaining. SceneManager &addBackScene(Scene &&scene); diff --git a/lib/wal/sources/System/System.hpp b/lib/wal/sources/System/System.hpp index 998da6b9..76a609e8 100644 --- a/lib/wal/sources/System/System.hpp +++ b/lib/wal/sources/System/System.hpp @@ -1,4 +1,6 @@ - +// +// Created by Zoe Roux on 2021-05-14. +// #pragma once diff --git a/lib/wal/sources/Wal.cpp b/lib/wal/sources/Wal.cpp index 67a1891e..f1c84e72 100644 --- a/lib/wal/sources/Wal.cpp +++ b/lib/wal/sources/Wal.cpp @@ -11,7 +11,7 @@ namespace WAL { std::chrono::nanoseconds Wal::timestep = 8ms; - SceneManager &Wal::getSceneManger() + SceneManager &Wal::getSceneManager() { return this->_scenes; } diff --git a/lib/wal/sources/Wal.hpp b/lib/wal/sources/Wal.hpp index c097436f..c8dd535c 100644 --- a/lib/wal/sources/Wal.hpp +++ b/lib/wal/sources/Wal.hpp @@ -101,7 +101,7 @@ namespace WAL } //! @brief Get the scene manager. - SceneManager &getSceneManger(); + SceneManager &getSceneManager(); //! @brief Start the game loop void run();