From 2b85c9343387aff7cde541d6c7ec46478eb0b0fc Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 19 Jan 2016 12:20:38 +0100 Subject: [PATCH] Sdk/EntityOwner: Prevent copy (Copying an EntityOwner has no use) Former-commit-id: 628eb865509a84de19bf97bf8253960d6bfb0005 --- SDK/include/NDK/EntityOwner.hpp | 5 ++--- SDK/include/NDK/EntityOwner.inl | 18 +----------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/SDK/include/NDK/EntityOwner.hpp b/SDK/include/NDK/EntityOwner.hpp index 3e2b6cdab..94dcf0566 100644 --- a/SDK/include/NDK/EntityOwner.hpp +++ b/SDK/include/NDK/EntityOwner.hpp @@ -16,16 +16,15 @@ namespace Ndk public: EntityOwner() = default; explicit EntityOwner(Entity* entity); - EntityOwner(const EntityOwner& handle); + EntityOwner(const EntityOwner& handle) = delete; EntityOwner(EntityOwner&& handle); ~EntityOwner(); void Reset(Entity* entity = nullptr); - void Reset(const EntityOwner& handle); void Reset(EntityOwner&& handle); EntityOwner& operator=(Entity* entity); - EntityOwner& operator=(const EntityOwner& handle); + EntityOwner& operator=(const EntityOwner& handle) = delete; EntityOwner& operator=(EntityOwner&& handle); }; } diff --git a/SDK/include/NDK/EntityOwner.inl b/SDK/include/NDK/EntityOwner.inl index c2335268f..e32094eaa 100644 --- a/SDK/include/NDK/EntityOwner.inl +++ b/SDK/include/NDK/EntityOwner.inl @@ -14,11 +14,6 @@ namespace Ndk Reset(entity); } - inline EntityOwner::EntityOwner(const EntityOwner& handle) : - EntityHandle(handle) - { - } - inline EntityOwner::EntityOwner(EntityOwner&& handle) : EntityHandle(std::move(handle)) { @@ -37,14 +32,10 @@ namespace Ndk EntityHandle::Reset(entity); } - inline void EntityOwner::Reset(const EntityOwner& handle) - { - Reset(handle.GetEntity()); - } - inline void EntityOwner::Reset(EntityOwner&& handle) { Reset(handle.GetEntity()); + handle.m_entity = nullptr; } inline EntityOwner& EntityOwner::operator=(Entity* entity) @@ -54,13 +45,6 @@ namespace Ndk return *this; } - inline EntityOwner& EntityOwner::operator=(const EntityOwner& handle) - { - Reset(handle); - - return *this; - } - inline EntityOwner& EntityOwner::operator=(EntityOwner&& handle) { Reset(std::move(handle));