Functions | Variables

# engine_sl.cpp File Reference

Code handling saving and loading of engines. More...

`#include "../stdafx.h"`
`#include "saveload_internal.h"`
`#include "../engine_base.h"`
`#include <map>`

Go to the source code of this file.

## Functions
Engine * | GetTempDataEngine (EngineID index)
static void | Save_ENGN ()
static void | Load_ENGN ()
void | CopyTempEngineData ()
| Copy data from temporary engine array into the real engine pool.
static void | Load_ENGS ()
static void | Save_EIDS ()
static void | Load_EIDS ()
## Variables
static const SaveLoad | _engine_desc []
static std::map< EngineID, Engine > | _temp_engine
static const SaveLoad | _engine_id_mapping_desc []
| Save and load the mapping between the engine id in the pool, and the grf file it came from.
const ChunkHandler | _engine_chunk_handlers []

## Detailed Description

Code handling saving and loading of engines.

Definition in file engine_sl.cpp.

## Variable Documentation

const ChunkHandler _engine_chunk_handlers[]

Initial value:

     {
      { 'EIDS', Save_EIDS, Load_EIDS, NULL, NULL, CH_ARRAY          },
      { 'ENGN', Save_ENGN, Load_ENGN, NULL, NULL, CH_ARRAY          },
      { 'ENGS', NULL,      Load_ENGS, NULL, NULL, CH_RIFF | CH_LAST },
    }

const SaveLoad _engine_desc[]`[static]`

Initial value:

     {
       SLE_CONDVAR(Engine, intro_date,          SLE_FILE_U16 | SLE_VAR_I32,  0,  30),
       SLE_CONDVAR(Engine, intro_date,          SLE_INT32,                  31, SL_MAX_VERSION),
       SLE_CONDVAR(Engine, age,                 SLE_FILE_U16 | SLE_VAR_I32,  0,  30),
       SLE_CONDVAR(Engine, age,                 SLE_INT32,                  31, SL_MAX_VERSION),
           SLE_VAR(Engine, reliability,         SLE_UINT16),
           SLE_VAR(Engine, reliability_spd_dec, SLE_UINT16),
           SLE_VAR(Engine, reliability_start,   SLE_UINT16),
           SLE_VAR(Engine, reliability_max,     SLE_UINT16),
           SLE_VAR(Engine, reliability_final,   SLE_UINT16),
           SLE_VAR(Engine, duration_phase_1,    SLE_UINT16),
           SLE_VAR(Engine, duration_phase_2,    SLE_UINT16),
           SLE_VAR(Engine, duration_phase_3,    SLE_UINT16),

      SLE_CONDNULL(1,                                                        0, 120),
           SLE_VAR(Engine, flags,               SLE_UINT8),
           SLE_VAR(Engine, preview_company_rank,SLE_UINT8),
           SLE_VAR(Engine, preview_wait,        SLE_UINT8),
      SLE_CONDNULL(1,                                                        0,  44),
       SLE_CONDVAR(Engine, company_avail,       SLE_FILE_U8  | SLE_VAR_U16,  0, 103),
       SLE_CONDVAR(Engine, company_avail,       SLE_UINT16,                104, SL_MAX_VERSION),
       SLE_CONDSTR(Engine, name,                SLE_STR, 0,                 84, SL_MAX_VERSION),

      SLE_CONDNULL(16,                                                       2, 143),

    }

Definition at line 17 of file engine_sl.cpp.

const SaveLoad _engine_id_mapping_desc[]`[static]`

Initial value:

     {
      SLE_VAR(EngineIDMapping, grfid,         SLE_UINT32),
      SLE_VAR(EngineIDMapping, internal_id,   SLE_UINT16),
      SLE_VAR(EngineIDMapping, type,          SLE_UINT8),
      SLE_VAR(EngineIDMapping, substitute_id, SLE_UINT8),

    }

Save and load the mapping between the engine id in the pool, and the grf file it came from.

Definition at line 120 of file engine_sl.cpp.