diff --git a/sources/Component/Sound/SoundComponent.cpp b/sources/Component/Sound/SoundComponent.cpp index 3265d724..a6a31323 100644 --- a/sources/Component/Sound/SoundComponent.cpp +++ b/sources/Component/Sound/SoundComponent.cpp @@ -9,7 +9,7 @@ namespace BBM { SoundComponent::SoundComponent(WAL::Entity &entity, \ -std::map &soundPath) +const std::map &soundPath) : WAL::Component(entity), _soundIndex(IDLE), _soundPath(soundPath) @@ -24,15 +24,9 @@ std::map &soundPath) } } - SoundComponent::SoundComponent(WAL::Entity &entity) - : Component(entity), - _soundList(), - _soundIndex() - {} - WAL::Component *SoundComponent::clone(WAL::Entity &entity) const { - return new SoundComponent(entity); + return new SoundComponent(entity, this->_soundPath); } void SoundComponent::playSound() diff --git a/sources/Component/Sound/SoundComponent.hpp b/sources/Component/Sound/SoundComponent.hpp index 6c35d197..1df2a537 100644 --- a/sources/Component/Sound/SoundComponent.hpp +++ b/sources/Component/Sound/SoundComponent.hpp @@ -50,7 +50,7 @@ namespace BBM //! @inherit WAL::Component *clone(WAL::Entity &entity) const override; //! @brief Create a new SoundComponent at a certain Sound - SoundComponent(WAL::Entity &entity, std::map &); + explicit SoundComponent(WAL::Entity &entity, const std::map &); //! @brief A Sound component is copy constructable SoundComponent(const SoundComponent &) = default; //! @brief A default destructor @@ -63,16 +63,11 @@ namespace BBM std::map _isLoad; - std::map _soundPath; + const std::map _soundPath; //! SoundIndex soundIndex _soundIndex; - - //! @brief Create a new SoundComponent linked to a specific entity - explicit SoundComponent(WAL::Entity &entity); - - }; } // namespace BBM \ No newline at end of file