CScene: Prevent redundant lookups in DeleteNode()
Avoids unnecessary repeated map lookups.
This commit is contained in:
parent
d7574a1965
commit
d9046b4fd9
|
@ -128,12 +128,13 @@ CLightNode* CScene::CreateLightNode(CLight *pLight, uint32 NodeID)
|
||||||
void CScene::DeleteNode(CSceneNode *pNode)
|
void CScene::DeleteNode(CSceneNode *pNode)
|
||||||
{
|
{
|
||||||
const ENodeType Type = pNode->NodeType();
|
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)
|
if (*it == pNode)
|
||||||
{
|
{
|
||||||
mNodes[Type].erase(it);
|
nodeEntry.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue