MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FinaliseObjectsArray

Function FinaliseObjectsArray

src/newgrf.cpp:1166–1181  ·  view source on GitHub ↗

* Add all new objects to the object array. Object properties can be set at any * time in the GRF file, so we can only add an object spec to the object array * after the file has finished loading. */

Source from the content-addressed store, hash-verified

1164 * after the file has finished loading.
1165 */
1166static void FinaliseObjectsArray()
1167{
1168 for (auto &file : _grf_files) {
1169 for (auto &objectspec : file.objectspec) {
1170 if (objectspec != nullptr && objectspec->grf_prop.HasGrfFile() && objectspec->IsEnabled()) {
1171 _object_mngr.SetEntitySpec(std::move(*objectspec));
1172 }
1173 }
1174
1175 /* Won't be used again */
1176 file.objectspec.clear();
1177 file.objectspec.shrink_to_fit();
1178 }
1179
1180 ObjectSpec::BindToClasses();
1181}
1182
1183/**
1184 * Add all new airports to the airport array. Airport properties can be set at any

Callers 1

AfterLoadGRFsFunction · 0.85

Calls 4

HasGrfFileMethod · 0.80
IsEnabledMethod · 0.45
SetEntitySpecMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected