don't call getChildren() thrice
This commit is contained in:
parent
e244ba4775
commit
833f029335
|
@ -199,11 +199,12 @@ void ThingTypeManager::loadOtb(const std::string& file)
|
||||||
root->skip(128); // description
|
root->skip(128); // description
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BinaryTreeVec children = root->getChildren();
|
||||||
m_reverseItemTypes.clear();
|
m_reverseItemTypes.clear();
|
||||||
m_itemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
|
m_itemTypes.resize(children.size() + 1, m_nullItemType);
|
||||||
m_reverseItemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
|
m_reverseItemTypes.resize(children.size() + 1, m_nullItemType);
|
||||||
|
|
||||||
for(const BinaryTreePtr& node : root->getChildren()) {
|
for(const BinaryTreePtr& node : children) {
|
||||||
ItemTypePtr itemType(new ItemType);
|
ItemTypePtr itemType(new ItemType);
|
||||||
itemType->unserialize(node);
|
itemType->unserialize(node);
|
||||||
addItemType(itemType);
|
addItemType(itemType);
|
||||||
|
|
Loading…
Reference in New Issue