# newgrf_sl.cpp File Reference

Code handling saving and loading of newgrf config. More...

`#include "../stdafx.h"`
`#include "../core/bitmath_func.hpp"`
`#include "../fios.h"`
`#include "saveload.h"`
`#include "newgrf_sl.h"`

Go to the source code of this file.

## Functions
void | Save_NewGRFMapping (const OverrideManagerBase &mapping)
| Save a GRF ID + local id -> OpenTTD's id mapping.
void | Load_NewGRFMapping (OverrideManagerBase &mapping)
| Load a GRF ID + local id -> OpenTTD's id mapping.
static void | Save_NGRF ()
static void | Load_NGRF_common (GRFConfig *&grfconfig)
static void | Load_NGRF ()
static void | Check_NGRF ()
## Variables
static const SaveLoad | _newgrf_mapping_desc []
| Save and load the mapping between a spec and the NewGRF it came from.
static const SaveLoad | _grfconfig_desc []
const ChunkHandler | _newgrf_chunk_handlers []

## Detailed Description

Code handling saving and loading of newgrf config.

Definition in file newgrf_sl.cpp.

## Function Documentation

void Load_NewGRFMapping | ( | OverrideManagerBase & | mapping | ) |

Load a GRF ID + local id -> OpenTTD's id mapping.

Parameters:

  | mapping | The mapping to load.

Definition at line 43 of file newgrf_sl.cpp.

References OverrideManagerBase::mapping_ID, OverrideManagerBase::ResetMapping(), SlIterateArray(), and SlObject().

void Save_NewGRFMapping | ( | const OverrideManagerBase & | mapping | ) |

Save a GRF ID + local id -> OpenTTD's id mapping.

Parameters:

  | mapping | The mapping to save.

Definition at line 31 of file newgrf_sl.cpp.

References OverrideManagerBase::mapping_ID, and SlObject().

## Variable Documentation

const SaveLoad _grfconfig_desc[]`[static]`

Initial value:

     {
          SLE_STR(GRFConfig, filename,         SLE_STR,    0x40),
          SLE_VAR(GRFConfig, ident.grfid,      SLE_UINT32),
          SLE_ARR(GRFConfig, ident.md5sum,     SLE_UINT8,  16),
      SLE_CONDVAR(GRFConfig, version,          SLE_UINT32, 151, SL_MAX_VERSION),
          SLE_ARR(GRFConfig, param,            SLE_UINT32, 0x80),
          SLE_VAR(GRFConfig, num_params,       SLE_UINT8),
      SLE_CONDVAR(GRFConfig, palette,          SLE_UINT8,  101, SL_MAX_VERSION),

    }

Definition at line 59 of file newgrf_sl.cpp.

const ChunkHandler _newgrf_chunk_handlers[]

Initial value:

     {
      { 'NGRF', Save_NGRF, Load_NGRF, NULL, Check_NGRF, CH_ARRAY | CH_LAST }
    }

const SaveLoad _newgrf_mapping_desc[]`[static]`

Initial value:

     {
      SLE_VAR(EntityIDMapping, grfid,         SLE_UINT32),
      SLE_VAR(EntityIDMapping, entity_id,     SLE_UINT8),
      SLE_VAR(EntityIDMapping, substitute_id, SLE_UINT8),

    }

Save and load the mapping between a spec and the NewGRF it came from.

Definition at line 20 of file newgrf_sl.cpp.