newgrf_config.h File Reference

Functions to find and configure NewGRFs. More...

#include "strings_type.h"

Go to the source code of this file.

Data Structures

struct  GRFIdentifier
 Basic data to distinguish a GRF. More...
struct  GRFError
 Information about why GRF had problems during initialisation. More...
struct  GRFConfig
 Information about GRF, used in the game and (part of it) in savegames. More...

Enumerations

enum  GCF_Flags {
  GCF_SYSTEM, GCF_UNSAFE, GCF_STATIC, GCF_COMPATIBLE,
  GCF_COPY, GCF_INIT_ONLY, GCF_RESERVED
}
 GRF config bit flags. More...
enum  GRFStatus {
  GCS_UNKNOWN, GCS_DISABLED, GCS_NOT_FOUND, GCS_INITIALISED,
  GCS_ACTIVATED
}
 Status of GRF. More...
enum  GRFBugs { GBUG_VEH_LENGTH, GBUG_VEH_REFIT }
 Encountered GRF bugs. More...
enum  GRFListCompatibility { GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND }
 Status of post-gameload GRF compatibility check. More...

Functions

void ScanNewGRFFiles ()
const GRFConfigFindGRFConfig (uint32 grfid, const uint8 *md5sum=NULL)
GRFConfigGetGRFConfig (uint32 grfid, uint32 mask=0xFFFFFFFF)
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
 First item in list of all scanned NewGRFs.
GRFConfig_grfconfig
 First item in list of current GRF set up.
GRFConfig_grfconfig_newgame
 First item in list of default GRF set up.
GRFConfig_grfconfig_static
 First item in list of static GRF set up.


Detailed Description

Functions to find and configure NewGRFs.

Definition in file newgrf_config.h.


Enumeration Type Documentation

enum GCF_Flags

GRF config bit 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 18 of file newgrf_config.h.

enum GRFBugs

Encountered GRF bugs.

Enumerator:
GBUG_VEH_LENGTH  Length of rail vehicle changes when not inside a depot.
GBUG_VEH_REFIT  Articulated vehicles carry different cargos resp. are differently refittable than specified in purchase list.

Definition at line 39 of file newgrf_config.h.

Status of post-gameload GRF compatibility check.

Enumerator:
GLC_ALL_GOOD  All GRF needed by game are present.
GLC_COMPATIBLE  Compatible (eg. the same ID, but different chacksum) GRF found in at least one case.
GLC_NOT_FOUND  At least one GRF couldn't be found (higher priority than GLC_COMPATIBLE).

Definition at line 45 of file newgrf_config.h.

enum GRFStatus

Status of GRF.

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 30 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 197 of file newgrf_config.cpp.

References CopyGRFConfigList(), GRFConfig::next, 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 209 of file newgrf_config.cpp.

References GRFConfig::next, and 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 133 of file newgrf_config.cpp.

References ClrBit(), GRFError::custom_message, GRFError::data, GRFConfig::error, GRFConfig::filename, GCF_COPY, GCF_INIT_ONLY, GRFConfig::info, GRFConfig::name, GRFConfig::next, and SetBit().

Referenced by AppendStaticGRFConfigs(), NewGRFConfirmationCallback(), and NewGRFWindow::OnClick().

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 235 of file newgrf_config.cpp.

References BSWAP32(), GRFConfig::error, GRFConfig::filename, GRFConfig::flags, GamelogGRFCompatible(), GamelogGRFRemove(), GCF_COMPATIBLE, GCF_COPY, GCS_NOT_FOUND, GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND, GRFIdentifier::grfid, HasBit(), GRFConfig::info, lastof, GRFIdentifier::md5sum, md5sumToString(), GRFConfig::name, GRFConfig::next, SetBit(), and GRFConfig::status.

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 1104 of file newgrf_gui.cpp.

References DeleteWindowByClass().


Generated on Sat Dec 26 20:06:11 2009 for OpenTTD by  doxygen 1.5.6