From c16f264920678139b1c56d24f627019ead7c260a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Mon, 7 Jun 2021 19:21:52 +0200 Subject: [PATCH] some non breaking changes fix (std::move + One ctor with opt params instead of multiple ctors) --- sources/Component/Health/HealthComponent.cpp | 14 +++----------- sources/Component/Health/HealthComponent.hpp | 8 +------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/sources/Component/Health/HealthComponent.cpp b/sources/Component/Health/HealthComponent.cpp index 20e2a3b6..5499d243 100644 --- a/sources/Component/Health/HealthComponent.cpp +++ b/sources/Component/Health/HealthComponent.cpp @@ -6,22 +6,14 @@ #include "HealthComponent.hpp" +#include + namespace BBM { - HealthComponent::HealthComponent(WAL::Entity &entity) - : WAL::Component(entity), - _healthPoint() - {} - - HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint) - : WAL::Component(entity), - _healthPoint(healthPoint) - {} - HealthComponent::HealthComponent(WAL::Entity &entity, unsigned int healthPoint, std::function callback) : WAL::Component(entity), _healthPoint(healthPoint), - onDeath(callback) + onDeath(std::move(callback)) {} WAL::Component *HealthComponent::clone(WAL::Entity &entity) const diff --git a/sources/Component/Health/HealthComponent.hpp b/sources/Component/Health/HealthComponent.hpp index 2ece2f0b..d8ff7531 100644 --- a/sources/Component/Health/HealthComponent.hpp +++ b/sources/Component/Health/HealthComponent.hpp @@ -34,15 +34,9 @@ namespace BBM //! @inherit WAL::Component *clone(WAL::Entity &entity) const override; - - //! @brief A Health component can't be instantiated, it should be derived. - explicit HealthComponent(WAL::Entity &entity); //! @brief Constructor - HealthComponent(WAL::Entity &entity, unsigned int healthPoint); - - //! @brief Constructor - HealthComponent(WAL::Entity &entity, unsigned int healthPoint, std::function callback); + explicit HealthComponent(WAL::Entity &entity, unsigned int healthPoint = 1, std::function callback = {}); //! @brief A Health component can't be instantiated, it should be derived. HealthComponent(const HealthComponent &) = default;