# newgrf_config.h File Reference

`#include "strings_type.h"`

Go to the source code of this file.

## Data Structures
struct | GRFIdentifier
struct | GRFError
struct | GRFConfig
## Enumerations
enum | GCF_Flags { GCF_SYSTEM, GCF_UNSAFE, GCF_STATIC, GCF_COMPATIBLE, GCF_COPY, GCF_INIT_ONLY, GCF_RESERVED }
enum | GRFStatus { GCS_UNKNOWN, GCS_DISABLED, GCS_NOT_FOUND, GCS_INITIALISED, GCS_ACTIVATED }
enum | GRFBugs { GBUG_VEH_LENGTH }
| Encountered GRF bugs. More...
enum | GRFListCompatibility { GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND }
| Status of post-gameload GRF compatibility check.
## Functions
void | ScanNewGRFFiles ()
const GRFConfig * | FindGRFConfig (uint32 grfid, const uint8 *md5sum=NULL)
GRFConfig * | GetGRFConfig (uint32 grfid)
GRFConfig ** | CopyGRFConfigList (GRFConfig **dst, const GRFConfig *src, bool init_only)
| Copy a GRF Config list.
void | AppendStaticGRFConfigs (GRFConfig **dst)
| Appends the static GRFs to a list of GRFs.
void | AppendToGRFConfigList (GRFConfig **dst, GRFConfig *el)
| Appends an element to a list of GRFs.
void | ClearGRFConfig (GRFConfig **config)
void | ClearGRFConfigList (GRFConfig **config)
void | ResetGRFConfig (bool defaults)
GRFListCompatibility | IsGoodGRFConfigList ()
| Check if all GRFs in the GRF config from a savegame can be loaded.
bool | FillGRFDetails (GRFConfig *config, bool is_static)
char * | GRFBuildParamList (char *dst, const GRFConfig *c, const char *last)
void | ShowNewGRFSettings (bool editable, bool show_params, bool exec_changes, GRFConfig **config)
| Setup the NewGRF gui.
## Variables
GRFConfig * | _all_grfs
GRFConfig * | _grfconfig
GRFConfig * | _grfconfig_newgame
GRFConfig * | _grfconfig_static

## Detailed Description

Definition in file newgrf_config.h.

## Enumeration Type Documentation

enum GCF_Flags

Enumerator:

  GCF_SYSTEM | GRF file is an openttd-internal system grf.
  GCF_UNSAFE | GRF file is unsafe for static usage.
  GCF_STATIC | GRF file is used statically (can be used in any MP game).
  GCF_COMPATIBLE | GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches).
  GCF_COPY | The data is copied from a grf in _all_grfs.
  GCF_INIT_ONLY | GRF file is processed up to GLS_INIT.
  GCF_RESERVED | GRF file passed GLS_RESERVE stage.

Definition at line 11 of file newgrf_config.h.

enum GRFBugs

Encountered GRF bugs.

Enumerator:

  GBUG_VEH_LENGTH | Length of rail vehicle changes when not inside a depot.

Definition at line 30 of file newgrf_config.h.

enum GRFStatus

Enumerator:

  GCS_UNKNOWN | The status of this grf file is unknown.
  GCS_DISABLED | GRF file is disabled.
  GCS_NOT_FOUND | GRF file was not found in the local cache.
  GCS_INITIALISED | GRF file has been initialised.
  GCS_ACTIVATED | GRF file has been activated.

Definition at line 21 of file newgrf_config.h.

## Function Documentation

void AppendStaticGRFConfigs | ( | GRFConfig ** | dst | ) |

Appends the static GRFs to a list of GRFs.

Parameters:

  | dst | the head of the list to add to

Definition at line 181 of file newgrf_config.cpp.

References CopyGRFConfigList(), and RemoveDuplicatesFromGRFConfigList().

void AppendToGRFConfigList | ( | GRFConfig ** | dst,
|  | GRFConfig * | el |
| ) |  |  |

Appends an element to a list of GRFs.

Parameters:

  | dst | the head of the list to add to
  | el | the new tail to be

Definition at line 193 of file newgrf_config.cpp.

References RemoveDuplicatesFromGRFConfigList().

GRFConfig** CopyGRFConfigList | ( | GRFConfig ** | dst,
|  | const GRFConfig * | src,
|  | bool | init_only |
| ) |  |  |

Copy a GRF Config list.

Parameters:

  | dst | pointer to destination list
  | src | pointer to source list values
  | init_only | the copied GRF will be processed up to GLS_INIT

Returns:
  pointer to the last value added to the destination list

Definition at line 119 of file newgrf_config.cpp.

References ClrBit(), GCF_INIT_ONLY, and SetBit().

Referenced by AppendStaticGRFConfigs(), NewGRFConfirmationCallback(), and ShowNewGRFSettings().

GRFListCompatibility IsGoodGRFConfigList | ( |  | ) |

Check if all GRFs in the GRF config from a savegame can be loaded.

Returns:
  will return any of the following 3 values:
  - GLC_ALL_GOOD: No problems occured, all GRF files were found and loaded
  - GLC_COMPATIBLE: For one or more GRF's no exact match was found, but a compatible GRF with the same grfid was found and used instead
  - GLC_NOT_FOUND: For one or more GRF's no match was found at all

Definition at line 219 of file newgrf_config.cpp.

References BSWAP32(), buf, GCF_COMPATIBLE, GCF_COPY, GCS_NOT_FOUND, HasBit(), md5sumToString(), and SetBit().

void ShowNewGRFSettings | ( | bool | editable,
|  | bool | show_params,
|  | bool | exec_changes,
|  | GRFConfig ** | config |
| ) |  |  |

Setup the NewGRF gui.

Parameters:

  | editable | allow the user to make changes to the grfconfig in the window
  | show_params | show information about what parameters are set for the grf files
  | exec_changes | if changes are made to the list (editable is true), apply these changes immediately or only update the list
  | config | pointer to a linked-list of grfconfig's that will be shown

Definition at line 578 of file newgrf_gui.cpp.

References AllocateWindowDesc(), and CopyGRFConfigList().