Browse Source

don't call getChildren() thrice

Maximilian 6 months ago
parent
commit
833f029335
No account linked to committer's email address
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      src/client/thingtypemanager.cpp

+ 4
- 3
src/client/thingtypemanager.cpp View File

@@ -199,11 +199,12 @@ void ThingTypeManager::loadOtb(const std::string& file)
199 199
             root->skip(128); // description
200 200
         }
201 201
 
202
+        BinaryTreeVec children = root->getChildren();
202 203
         m_reverseItemTypes.clear();
203
-        m_itemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
204
-        m_reverseItemTypes.resize(root->getChildren().size() + 1, m_nullItemType);
204
+        m_itemTypes.resize(children.size() + 1, m_nullItemType);
205
+        m_reverseItemTypes.resize(children.size() + 1, m_nullItemType);
205 206
 
206
-        for(const BinaryTreePtr& node : root->getChildren()) {
207
+        for(const BinaryTreePtr& node : children) {
207 208
             ItemTypePtr itemType(new ItemType);
208 209
             itemType->unserialize(node);
209 210
             addItemType(itemType);

Loading…
Cancel
Save