Merge pull request #1030 from Shawak/patch-1
don't call getChildren() thrice
This commit is contained in:
commit
fdba9d5e9c
|
@ -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