mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use reserve/emplace when initializing object definitions.
This avoids unnecessary initialization of objects.pull/10697/head
parent
a967cc4de2
commit
d0c71f2a9e
|
@ -123,11 +123,11 @@ void ResetObjects()
|
|||
_object_specs.clear();
|
||||
|
||||
/* And add our originals. */
|
||||
_object_specs.resize(lengthof(_original_objects));
|
||||
_object_specs.reserve(lengthof(_original_objects));
|
||||
|
||||
for (uint16 i = 0; i < lengthof(_original_objects); i++) {
|
||||
_object_specs[i] = _original_objects[i];
|
||||
_object_specs[i].grf_prop.local_id = i;
|
||||
ObjectSpec &spec = _object_specs.emplace_back(_original_objects[i]);
|
||||
spec.grf_prop.local_id = i;
|
||||
}
|
||||
|
||||
/* Set class for originals. */
|
||||
|
|
Loading…
Reference in New Issue