From eb3b48e5239fc0dfab9d97ec2224aa65e1712dad Mon Sep 17 00:00:00 2001 From: Marc-Antoine Lortie Date: Tue, 14 Mar 2023 09:21:45 -0400 Subject: [PATCH] Invert logic in build_bone_children_hierarchy. --- code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp index f3a383e8e..a8141fcc1 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp +++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.cpp @@ -516,19 +516,19 @@ void HL1MDLLoader::read_bones() { void HL1MDLLoader::build_bone_children_hierarchy(const TempBone &bone) { - if (bone.children.size() > 0) - { - aiNode* bone_node = bone.node; - bone_node->mNumChildren = static_cast(bone.children.size()); - bone_node->mChildren = new aiNode *[bone_node->mNumChildren]; + if (bone.children.empty()) + return; - // Build each child bone's hierarchy recursively. - for (size_t i = 0; i < bone.children.size(); ++i) - { - const TempBone &child_bone = temp_bones_[bone.children[i]]; - bone_node->mChildren[i] = child_bone.node; - build_bone_children_hierarchy(child_bone); - } + aiNode* bone_node = bone.node; + bone_node->mNumChildren = static_cast(bone.children.size()); + bone_node->mChildren = new aiNode *[bone_node->mNumChildren]; + + // Build each child bone's hierarchy recursively. + for (size_t i = 0; i < bone.children.size(); ++i) + { + const TempBone &child_bone = temp_bones_[bone.children[i]]; + bone_node->mChildren[i] = child_bone.node; + build_bone_children_hierarchy(child_bone); } }