CScene: Prevent redundant lookups in DeleteNode()

Avoids unnecessary repeated map lookups.
This commit is contained in:
Lioncash 2020-06-19 19:24:56 -04:00
parent d7574a1965
commit d9046b4fd9
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}
}