Skip to content

Commit faa335e

Browse files
committed
Optimisation #1: fewer copies, more brain work
1 parent 134a30e commit faa335e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

BMEdit/GameLib/Source/GameLib/Scene/SceneObjectPropertiesLoader.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ namespace gamelib::scene
9797
}
9898

9999
// Read properties
100-
Value properties;
101100
{
102101
const auto& [vRes, _newInstructions] = objectType->verify(ip);
103102
if (!vRes)
@@ -112,7 +111,7 @@ namespace gamelib::scene
112111
throw SceneObjectVisitorException(objectIdx, "Invalid instructions set (verification failed) [2]");
113112
}
114113

115-
properties = *value;
114+
currentObject->getProperties() = *value;
116115
ip = newIP; // Assign new ip
117116
}
118117

@@ -134,8 +133,6 @@ namespace gamelib::scene
134133

135134
NEXT_IP
136135

137-
std::map<std::string, Value> controllers;
138-
139136
if (controllersCount > 0)
140137
{
141138
for (int32_t controllerIdx = 0; controllerIdx < controllersCount; ++controllerIdx)
@@ -192,7 +189,7 @@ namespace gamelib::scene
192189

193190
ip = nextIP;
194191

195-
controllers[controllerName] = controllerMapResult.value();
192+
currentObject->getControllers()[controllerName] = controllerMapResult.value();
196193

197194
if (ip[0].getOpCode() != PRPOpCode::EndObject && reinterpret_cast<const TypeComplex*>(controllerType)->areUnexposedInstructionsAllowed())
198195
{
@@ -214,8 +211,9 @@ namespace gamelib::scene
214211

215212
auto unexposedInstructions = begin.slice(0, ip.size() - endOffset).as<std::vector<PRPInstruction>>();
216213

217-
auto& orgInstructionsRef = controllers[controllerName].getInstructions();
218-
orgInstructionsRef.insert(orgInstructionsRef.end(), unexposedInstructions.begin(), unexposedInstructions.end());
214+
//FIXME: Do it better!!!
215+
// auto& orgInstructionsRef = controllers[controllerName].getInstructions();
216+
// orgInstructionsRef.insert(orgInstructionsRef.end(), unexposedInstructions.begin(), unexposedInstructions.end());
219217

220218
ip = ip.slice(endOffset, ip.size() - endOffset);
221219
}
@@ -229,9 +227,6 @@ namespace gamelib::scene
229227
}
230228
}
231229

232-
currentObject->getControllers() = controllers;
233-
currentObject->getProperties() = properties;
234-
235230
if (parent)
236231
{
237232
currentObject->setParent(parent);

0 commit comments

Comments
 (0)