/** * Copy data from temporary engine array into the real engine pool. */ void CopyTempEngineData() { Engine *e; FOR_ALL_ENGINES(e) { if (e->index >= _temp_engine.size()) break; const Engine *se = GetTempDataEngine(e->index); e->intro_date = se->intro_date; e->age = se->age; e->reliability = se->reliability; e->reliability_spd_dec = se->reliability_spd_dec; e->reliability_start = se->reliability_start; e->reliability_max = se->reliability_max; e->reliability_final = se->reliability_final; e->duration_phase_1 = se->duration_phase_1; e->duration_phase_2 = se->duration_phase_2; e->duration_phase_3 = se->duration_phase_3; e->flags = se->flags; e->preview_asked = se->preview_asked; e->preview_company = se->preview_company; e->preview_wait = se->preview_wait; e->company_avail = se->company_avail; if (se->name != NULL) e->name = strdup(se->name); } /* Get rid of temporary data */ _temp_engine.clear(); }
static void Load_ENGN() { /* As engine data is loaded before engines are initialized we need to load * this information into a temporary array. This is then copied into the * engine pool after processing NewGRFs by CopyTempEngineData(). */ int index; while ((index = SlIterateArray()) != -1) { Engine *e = GetTempDataEngine(index); SlObject(e, _engine_desc); } }
static void Load_ENGS() { /* Load old separate String ID list into a temporary array. This * was always 256 entries. */ StringID names[256]; SlArray(names, lengthof(names), SLE_STRINGID); /* Copy each string into the temporary engine array. */ for (EngineID engine = 0; engine < lengthof(names); engine++) { Engine *e = GetTempDataEngine(engine); e->name = CopyFromOldName(names[engine]); } }
static void Load_ENGN() { /* As engine data is loaded before engines are initialized we need to load * this information into a temporary array. This is then copied into the * engine pool after processing NewGRFs by CopyTempEngineData(). */ int index; while ((index = SlIterateArray()) != -1) { Engine *e = GetTempDataEngine(index); SlObject(e, _engine_desc); if (IsSavegameVersionBefore(179)) { /* preview_company_rank was replaced with preview_company and preview_asked. * Just cancel any previews. */ e->flags &= ~4; // ENGINE_OFFER_WINDOW_OPEN e->preview_company = INVALID_COMPANY; e->preview_asked = (CompanyMask)-1; } } }