From 9335925b486c02a32c5c2ebb0ec03f15509482a8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 18 Feb 2024 20:16:20 +0100 Subject: [PATCH] Simplify code #1949 --- Source/Engine/Level/Actor.cpp | 11 +++-------- Source/Engine/Level/Actor.h | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index 6e8c2e7b4..cd6b156d8 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -1358,16 +1358,11 @@ bool Actor::IsPrefabRoot() const Actor* Actor::GetPrefabRoot() { - if (!this->HasPrefabLink()) - { - return NULL; - } - + if (!HasPrefabLink()) + return nullptr; Actor* result = this; - while (!result == NULL && !result->IsPrefabRoot()) - { + while (result && !result->IsPrefabRoot()) result = result->GetParent(); - } return result; } diff --git a/Source/Engine/Level/Actor.h b/Source/Engine/Level/Actor.h index d34d66e49..feba73997 100644 --- a/Source/Engine/Level/Actor.h +++ b/Source/Engine/Level/Actor.h @@ -794,7 +794,7 @@ public: { return (T*)FindActor(T::GetStaticClass(), name); } - + /// /// Tries to find the actor of the given type and tag in this actor hierarchy (checks this actor and all children hierarchy). ///