diff --git a/SDK/include/NDK/Algorithm.inl b/SDK/include/NDK/Algorithm.inl index e79e3a901..77863e232 100644 --- a/SDK/include/NDK/Algorithm.inl +++ b/SDK/include/NDK/Algorithm.inl @@ -13,7 +13,7 @@ namespace Ndk static_assert(N-1 <= sizeof(ComponentId), "Name too long for this size of component id"); ComponentId componentId = 0; - for (int i = 0; i < N; ++i) + for (unsigned int i = 0; i < N; ++i) componentId |= static_cast(name[i]) << i*8; return componentId; diff --git a/SDK/include/NDK/Components/ListenerComponent.hpp b/SDK/include/NDK/Components/ListenerComponent.hpp index 15d6d07f7..bee1ac14a 100644 --- a/SDK/include/NDK/Components/ListenerComponent.hpp +++ b/SDK/include/NDK/Components/ListenerComponent.hpp @@ -18,7 +18,7 @@ namespace Ndk ~ListenerComponent() = default; bool IsActive() const; - bool SetActive(bool active = true); + void SetActive(bool active = true); static ComponentIndex componentIndex; diff --git a/SDK/include/NDK/Components/ListenerComponent.inl b/SDK/include/NDK/Components/ListenerComponent.inl index fb18a862f..7dc7b0391 100644 --- a/SDK/include/NDK/Components/ListenerComponent.inl +++ b/SDK/include/NDK/Components/ListenerComponent.inl @@ -14,7 +14,7 @@ namespace Ndk return m_isActive; } - inline bool ListenerComponent::SetActive(bool active) + inline void ListenerComponent::SetActive(bool active) { m_isActive = active; } diff --git a/SDK/include/NDK/EntityHandle.hpp b/SDK/include/NDK/EntityHandle.hpp index 309016a7c..21d3f3820 100644 --- a/SDK/include/NDK/EntityHandle.hpp +++ b/SDK/include/NDK/EntityHandle.hpp @@ -67,6 +67,8 @@ namespace Ndk friend bool operator>=(const Entity& lhs, const EntityHandle& rhs); friend bool operator>=(const EntityHandle& lhs, const Entity& rhs); + static const EntityHandle InvalidHandle; + private: void OnEntityDestroyed(); void OnEntityMoved(Entity* newEntity); diff --git a/SDK/include/NDK/EntityHandle.inl b/SDK/include/NDK/EntityHandle.inl index 57cbbb2db..fa2a55469 100644 --- a/SDK/include/NDK/EntityHandle.inl +++ b/SDK/include/NDK/EntityHandle.inl @@ -86,6 +86,7 @@ namespace Ndk // On effectue l'échange std::swap(m_entity, handle.m_entity); + return *this; } inline EntityHandle::operator bool() const @@ -106,16 +107,22 @@ namespace Ndk inline EntityHandle& EntityHandle::operator=(Entity* entity) { Reset(entity); + + return *this; } inline EntityHandle& EntityHandle::operator=(const EntityHandle& handle) { Reset(handle); + + return *this; } inline EntityHandle& EntityHandle::operator=(EntityHandle&& handle) { Reset(handle); + + return *this; } inline void EntityHandle::OnEntityDestroyed() diff --git a/SDK/src/NDK/EntityHandle.cpp b/SDK/src/NDK/EntityHandle.cpp new file mode 100644 index 000000000..7b9d035e3 --- /dev/null +++ b/SDK/src/NDK/EntityHandle.cpp @@ -0,0 +1,10 @@ +// Copyright (C) 2015 Jérôme Leclercq +// This file is part of the "Nazara Development Kit" +// For conditions of distribution and use, see copyright notice in Prerequesites.hpp + +#include + +namespace Ndk +{ + const EntityHandle EntityHandle::InvalidHandle; +} diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 98d75e6f3..0bbf2b9f9 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -79,7 +79,7 @@ namespace Ndk else { NazaraError("Invalid ID"); - return EntityHandle(); + return EntityHandle::InvalidHandle; } }