(EntityHandle) Fixed hashs
Former-commit-id: f5d23d81a5b46dfbf90d2004dfeb9595f30c2df2
This commit is contained in:
parent
c25f824f65
commit
28b0e26a88
|
|
@ -3,6 +3,7 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace Ndk
|
namespace Ndk
|
||||||
{
|
{
|
||||||
|
|
@ -242,7 +243,11 @@ namespace std
|
||||||
{
|
{
|
||||||
size_t operator()(const Ndk::EntityHandle& handle) const
|
size_t operator()(const Ndk::EntityHandle& handle) const
|
||||||
{
|
{
|
||||||
return hash<Ndk::Entity*>()(handle.GetEntity());
|
// Hasher le pointeur fonctionnerait jusqu'à ce que l'entité soit mise à jour et déplacée
|
||||||
|
// pour cette raison, nous devons hasher l'ID de l'entité (qui reste constante)
|
||||||
|
Ndk::EntityId id = (handle.IsValid()) ? handle->GetId() : std::numeric_limits<Ndk::EntityId>::max();
|
||||||
|
|
||||||
|
return hash<Ndk::EntityId>()(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue