Sdk/Entity: Fix movement
Fixes OnEntityDestruction not being moved
This commit is contained in:
parent
8ab1462402
commit
97067cb566
|
|
@ -140,6 +140,7 @@ Nazara Development Kit:
|
||||||
- Add DebugComponent (a component able to show aabb/obb/collision mesh)
|
- Add DebugComponent (a component able to show aabb/obb/collision mesh)
|
||||||
- ⚠️ TextAreaWidget now support text selection (WIP)
|
- ⚠️ TextAreaWidget now support text selection (WIP)
|
||||||
- ⚠️ TextAreaWidget::GetHoveredGlyph now returns a two-dimensional position instead of a single glyph position
|
- ⚠️ TextAreaWidget::GetHoveredGlyph now returns a two-dimensional position instead of a single glyph position
|
||||||
|
- Fixed Entity::OnEntityDestruction signal not being properly moved and thus not being called.
|
||||||
|
|
||||||
# 0.4:
|
# 0.4:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <Nazara/Core/Bitset.hpp>
|
#include <Nazara/Core/Bitset.hpp>
|
||||||
#include <Nazara/Core/HandledObject.hpp>
|
#include <Nazara/Core/HandledObject.hpp>
|
||||||
|
#include <Nazara/Core/MovablePtr.hpp>
|
||||||
#include <Nazara/Core/Signal.hpp>
|
#include <Nazara/Core/Signal.hpp>
|
||||||
#include <NDK/Algorithm.hpp>
|
#include <NDK/Algorithm.hpp>
|
||||||
#include <NDK/Prerequisites.hpp>
|
#include <NDK/Prerequisites.hpp>
|
||||||
|
|
@ -33,7 +34,7 @@ namespace Ndk
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Entity(const Entity&) = delete;
|
Entity(const Entity&) = delete;
|
||||||
Entity(Entity&& entity);
|
Entity(Entity&& entity) noexcept;
|
||||||
~Entity();
|
~Entity();
|
||||||
|
|
||||||
BaseComponent& AddComponent(std::unique_ptr<BaseComponent>&& component);
|
BaseComponent& AddComponent(std::unique_ptr<BaseComponent>&& component);
|
||||||
|
|
@ -96,8 +97,8 @@ namespace Ndk
|
||||||
Nz::Bitset<> m_componentBits;
|
Nz::Bitset<> m_componentBits;
|
||||||
Nz::Bitset<> m_removedComponentBits;
|
Nz::Bitset<> m_removedComponentBits;
|
||||||
Nz::Bitset<> m_systemBits;
|
Nz::Bitset<> m_systemBits;
|
||||||
|
Nz::MovablePtr<World> m_world;
|
||||||
EntityId m_id;
|
EntityId m_id;
|
||||||
World* m_world;
|
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
bool m_valid;
|
bool m_valid;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,26 +14,8 @@ namespace Ndk
|
||||||
* \brief NDK class that represents an entity in a world
|
* \brief NDK class that represents an entity in a world
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
// Must exists in .cpp file because of BaseComponent unique_ptr
|
||||||
* \brief Constructs a Entity object by move semantic
|
Entity::Entity(Entity&&) noexcept = default;
|
||||||
*
|
|
||||||
* \param entity Entity to move into this
|
|
||||||
*/
|
|
||||||
|
|
||||||
Entity::Entity(Entity&& entity) :
|
|
||||||
HandledObject(std::move(entity)),
|
|
||||||
m_components(std::move(entity.m_components)),
|
|
||||||
m_containedInLists(std::move(entity.m_containedInLists)),
|
|
||||||
m_componentBits(std::move(entity.m_componentBits)),
|
|
||||||
m_removedComponentBits(std::move(entity.m_removedComponentBits)),
|
|
||||||
m_systemBits(std::move(entity.m_systemBits)),
|
|
||||||
m_id(entity.m_id),
|
|
||||||
m_world(entity.m_world),
|
|
||||||
m_enabled(entity.m_enabled),
|
|
||||||
m_valid(entity.m_valid)
|
|
||||||
{
|
|
||||||
entity.m_world = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructs a Entity object linked to a world and with an id
|
* \brief Constructs a Entity object linked to a world and with an id
|
||||||
|
|
@ -41,7 +23,6 @@ namespace Ndk
|
||||||
* \param world World in which the entity interact
|
* \param world World in which the entity interact
|
||||||
* \param id Identifier of the entity
|
* \param id Identifier of the entity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Entity::Entity(World* world, EntityId id) :
|
Entity::Entity(World* world, EntityId id) :
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_world(world)
|
m_world(world)
|
||||||
|
|
@ -53,7 +34,6 @@ namespace Ndk
|
||||||
*
|
*
|
||||||
* \see Destroy
|
* \see Destroy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Entity::~Entity()
|
Entity::~Entity()
|
||||||
{
|
{
|
||||||
if (m_world && m_valid)
|
if (m_world && m_valid)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue