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

Method Load

src/saveload/engine_sl.cpp:70–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 }
69
70 void Load() const override
71 {
72 const std::vector<SaveLoad> slt = SlCompatTableHeader(_engine_desc, _engine_sl_compat);
73
74 /* As engine data is loaded before engines are initialized we need to load
75 * this information into a temporary array. This is then copied into the
76 * engine pool after processing NewGRFs by CopyTempEngineData(). */
77 int index;
78 while ((index = SlIterateArray()) != -1) {
79 Engine *e = GetTempDataEngine(static_cast<EngineID>(index));
80 SlObject(e, slt);
81
82 if (IsSavegameVersionBefore(SLV_179)) {
83 /* preview_company_rank was replaced with preview_company and preview_asked.
84 * Just cancel any previews. */
85 e->flags.Reset(EngineFlag{2}); // ENGINE_OFFER_WINDOW_OPEN
86 e->preview_company = CompanyID::Invalid();
87 e->preview_asked.Set();
88 }
89 }
90 }
91};
92
93/**

Callers

nothing calls this directly

Calls 8

SlCompatTableHeaderFunction · 0.85
SlIterateArrayFunction · 0.85
GetTempDataEngineFunction · 0.85
SlObjectFunction · 0.85
IsSavegameVersionBeforeFunction · 0.85
InvalidFunction · 0.85
ResetMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected