GRFConfig Struct Reference

Information about GRF, used in the game and (part of it) in savegames. More...

#include <newgrf_config.h>

Inheritance diagram for GRFConfig:
ZeroedMemoryAllocator

Public Member Functions

 GRFConfig (const char *filename=NULL)
 Create a new GRFConfig.
 GRFConfig (const GRFConfig &config)
 Create a new GRFConfig that is a deep copy of an existing config.
 ~GRFConfig ()
 Cleanup a GRFConfig object.
bool IsOpenTTDBaseGRF () const
 Checks whether this GRF is a OpenTTD base graphic GRF.
const char * GetName () const
 Get the name of this grf.
const char * GetDescription () const
 Get the grf info.
void SetParameterDefaults ()
 Set the default value for all parameters as specified by action14.
void SetSuitablePalette ()
 Set the palette of this GRFConfig to something suitable.

Data Fields

GRFIdentifier ident
 grfid and md5sum to uniquely identify newgrfs
uint8 original_md5sum [16]
 MD5 checksum of original file if only a 'compatible' file was loaded.
char * filename
 Filename - either with or without full path.
struct GRFTextname
 NOSAVE: GRF name (Action 0x08).
struct GRFTextinfo
 NOSAVE: GRF info (author, copyright, ...) (Action 0x08).
GRFErrorerror
 NOSAVE: Error/Warning during GRF loading (Action 0x0B).
uint32 version
 NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown.
uint32 min_loadable_version
 NOSAVE: Minimum compatible version a NewGRF can define.
uint8 flags
 NOSAVE: GCF_Flags, bitset.
GRFStatus status
 NOSAVE: GRFStatus, enum.
uint32 grf_bugs
 NOSAVE: bugs in this GRF in this run,.
uint32 param [0x80]
 GRF parameters.
uint8 num_params
 Number of used parameters.
uint8 num_valid_params
 NOSAVE: Number of valid parameters (action 0x14).
uint8 palette
 GRFPalette, bitset.
SmallVector< GRFParameterInfo *, 4 > param_info
 NOSAVE: extra information about the parameters.
bool has_param_defaults
 NOSAVE: did this newgrf specify any defaults for it's parameters.
struct GRFConfignext
 NOSAVE: Next item in the linked list.

Detailed Description

Information about GRF, used in the game and (part of it) in savegames.

Definition at line 133 of file newgrf_config.h.


Constructor & Destructor Documentation

GRFConfig::GRFConfig ( const char *  filename = NULL  ) 

Create a new GRFConfig.

Parameters:
filename Set the filename of this GRFConfig to filename. The argument is copied so the original string isn't needed after the constructor.

Definition at line 29 of file newgrf_config.cpp.

GRFConfig::GRFConfig ( const GRFConfig config  ) 

Create a new GRFConfig that is a deep copy of an existing config.

Parameters:
config The GRFConfig object to make a copy of.

Definition at line 39 of file newgrf_config.cpp.

References SmallVector< T, S >::Append(), DuplicateGRFText(), error, filename, info, SmallVector< T, S >::Length(), lengthof, name, original_md5sum, param, and param_info.

GRFConfig::~GRFConfig (  ) 

Cleanup a GRFConfig object.

Definition at line 68 of file newgrf_config.cpp.

References CleanUpGRFText(), error, filename, flags, GCF_COPY, HasBit(), info, SmallVector< T, S >::Length(), name, and param_info.


Member Function Documentation

const char * GRFConfig::GetDescription (  )  const

Get the grf info.

Returns:
A string with a description of this grf.

Definition at line 96 of file newgrf_config.cpp.

References GetGRFStringFromGRFText(), and info.

const char * GRFConfig::GetName (  )  const

Get the name of this grf.

In case the name isn't known the filename is returned.

Returns:
The name of filename of this grf.

Definition at line 86 of file newgrf_config.cpp.

References filename, GetGRFStringFromGRFText(), name, and StrEmpty().

Referenced by GRFFileScanner::AddFile(), DEF_UDP_RECEIVE_COMMAND(), DisableStaticNewGRFInfluencingNonStaticNewGRFs(), NewGRFWindow::DrawWidget(), GRFSorter(), NewGRFWindow::OnClick(), and ShowNewGrfVehicleError().

bool GRFConfig::IsOpenTTDBaseGRF (  )  const

Checks whether this GRF is a OpenTTD base graphic GRF.

Returns:
true if and only if it is a base GRF.

Definition at line 733 of file newgrf_config.cpp.

References GRFIdentifier::grfid, ident, and OPENTTD_GRAPHICS_BASE_GRF_ID.

Referenced by FillGRFDetails(), and NewGRFWindow::OnInvalidateData().

void GRFConfig::SetParameterDefaults (  ) 

Set the default value for all parameters as specified by action14.

Definition at line 102 of file newgrf_config.cpp.

References has_param_defaults, SmallVector< T, S >::Length(), lengthof, num_params, param, and param_info.

Referenced by NewGRFWindow::OnClick(), and NewGRFParametersWindow::OnClick().

void GRFConfig::SetSuitablePalette (  ) 

Set the palette of this GRFConfig to something suitable.

That is either the setting coming from the NewGRF or the globally used palette.

Definition at line 120 of file newgrf_config.cpp.

References _use_palette, GRFP_GRF_DOS, GRFP_GRF_MASK, GRFP_GRF_WINDOWS, GRFP_USE_BIT, GRFP_USE_DOS, GRFP_USE_WINDOWS, PAL_DOS, PAL_WINDOWS, palette, and SB().

Referenced by FillGRFDetails().


Field Documentation

NOSAVE: bugs in this GRF in this run,.

See also:
enum GRFBugs

Definition at line 149 of file newgrf_config.h.

Referenced by RailVehicleLengthChanged(), and ShowNewGrfVehicleError().


The documentation for this struct was generated from the following files:

Generated on Sun Jan 9 16:02:53 2011 for OpenTTD by  doxygen 1.6.1