From d9046b4fd9aa4de770247928949aeb9a5c271f63 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 19 Jun 2020 19:24:56 -0400 Subject: [PATCH] CScene: Prevent redundant lookups in DeleteNode() Avoids unnecessary repeated map lookups. --- src/Core/Scene/CScene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Core/Scene/CScene.cpp b/src/Core/Scene/CScene.cpp index 72587ec4..b2cd3518 100644 --- a/src/Core/Scene/CScene.cpp +++ b/src/Core/Scene/CScene.cpp @@ -128,12 +128,13 @@ CLightNode* CScene::CreateLightNode(CLight *pLight, uint32 NodeID) void CScene::DeleteNode(CSceneNode *pNode) { const ENodeType Type = pNode->NodeType(); + auto& nodeEntry = mNodes[Type]; - for (auto it = mNodes[Type].begin(); it != mNodes[Type].end(); ++it) + for (auto it = nodeEntry.begin(); it != nodeEntry.end(); ++it) { if (*it == pNode) { - mNodes[Type].erase(it); + nodeEntry.erase(it); break; } }