Core/Node: Improved SetParent check
Former-commit-id: f9863603ee5f4b2d31b66716fa58f9749f5271ae
This commit is contained in:
parent
e55b4edd0c
commit
045aa86c9c
|
|
@ -416,10 +416,17 @@ void NzNode::SetInitialScale(float scaleX, float scaleY, float scaleZ)
|
||||||
void NzNode::SetParent(const NzNode* node, bool keepDerived)
|
void NzNode::SetParent(const NzNode* node, bool keepDerived)
|
||||||
{
|
{
|
||||||
#if NAZARA_UTILITY_SAFE
|
#if NAZARA_UTILITY_SAFE
|
||||||
if (node == this)
|
// On vérifie que le node n'est pas son propre parent
|
||||||
|
const NzNode* parentNode = node;
|
||||||
|
while (parentNode)
|
||||||
{
|
{
|
||||||
NazaraError("A node cannot be it's own parent");
|
if (parentNode == this)
|
||||||
return;
|
{
|
||||||
|
NazaraError("A node cannot be it's own parent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentNode = parentNode->GetParent();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue