mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
Codechange: Use reserve/emplace when initializing object definitions.
This avoids unnecessary initialization of objects.
This commit is contained in:
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
Block a user