Codechange: Use reserve/emplace when initializing object definitions.

This avoids unnecessary initialization of objects.
This commit is contained in:
Peter Nelson 2023-04-18 13:03:08 +01:00 committed by PeterN
parent a967cc4de2
commit d0c71f2a9e

View File

@ -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. */