OpenTTD Source
20241120-master-g6d3adc6169
|
Information about GRF, used in the game and (part of it) in savegames. More...
#include <newgrf_config.h>
Public Member Functions | |
GRFConfig (const std::string &filename=std::string{}) | |
Create a new GRFConfig. More... | |
GRFConfig (const GRFConfig &config) | |
Create a new GRFConfig that is a deep copy of an existing config. More... | |
GRFConfig & | operator= (GRFConfig &rhs)=delete |
bool | IsCompatible (uint32_t old_version) const |
Return whether this NewGRF can replace an older version of the same NewGRF. | |
void | SetParams (const std::vector< uint32_t > &pars) |
void | CopyParams (const GRFConfig &src) |
Copy the parameter information from the src config. More... | |
std::optional< std::string > | GetTextfile (TextfileType type) const |
Search a textfile file next to this NewGRF. More... | |
const char * | GetName () const |
Get the name of this grf. More... | |
const char * | GetDescription () const |
Get the grf info. More... | |
const char * | GetURL () const |
Get the grf url. More... | |
void | SetParameterDefaults () |
Set the default value for all parameters as specified by action14. | |
void | SetSuitablePalette () |
Set the palette of this GRFConfig to something suitable. More... | |
void | FinalizeParameterInfo () |
Finalize Action 14 info after file scan is finished. | |
Public Member Functions inherited from ZeroedMemoryAllocator | |
void * | operator new (size_t size) |
Memory allocator for a single class instance. More... | |
void * | operator new[] (size_t size) |
Memory allocator for an array of class instances. More... | |
void | operator delete (void *ptr) |
Memory release for a single class instance. More... | |
void | operator delete[] (void *ptr) |
Memory release for an array of class instances. More... | |
Data Fields | |
GRFIdentifier | ident |
grfid and md5sum to uniquely identify newgrfs | |
MD5Hash | original_md5sum |
MD5 checksum of original file if only a 'compatible' file was loaded. | |
std::string | filename |
Filename - either with or without full path. | |
GRFTextWrapper | name |
NOSAVE: GRF name (Action 0x08) | |
GRFTextWrapper | info |
NOSAVE: GRF info (author, copyright, ...) (Action 0x08) | |
GRFTextWrapper | url |
NOSAVE: URL belonging to this GRF. | |
std::optional< GRFError > | error |
NOSAVE: Error/Warning during GRF loading (Action 0x0B) | |
uint32_t | version |
NOSAVE: Version a NewGRF can set so only the newest NewGRF is shown. | |
uint32_t | min_loadable_version |
NOSAVE: Minimum compatible version a NewGRF can define. | |
uint8_t | flags |
NOSAVE: GCF_Flags, bitset. | |
GRFStatus | status |
NOSAVE: GRFStatus, enum. | |
uint32_t | grf_bugs |
NOSAVE: bugs in this GRF in this run,. More... | |
std::array< uint32_t, 0x80 > | param |
GRF parameters. | |
uint8_t | num_params |
Number of used parameters. | |
uint8_t | num_valid_params |
NOSAVE: Number of valid parameters (action 0x14) | |
uint8_t | palette |
GRFPalette, bitset. | |
std::vector< std::optional< GRFParameterInfo > > | param_info |
NOSAVE: extra information about the parameters. | |
bool | has_param_defaults |
NOSAVE: did this newgrf specify any defaults for it's parameters. | |
struct GRFConfig * | next |
NOSAVE: Next item in the linked list. | |
Information about GRF, used in the game and (part of it) in savegames.
Definition at line 146 of file newgrf_config.h.
GRFConfig::GRFConfig | ( | const std::string & | filename = std::string{} | ) |
Create a new GRFConfig.
filename | Set the filename of this GRFConfig to filename. |
Definition at line 37 of file newgrf_config.cpp.
GRFConfig::GRFConfig | ( | const GRFConfig & | config | ) |
Create a new GRFConfig that is a deep copy of an existing config.
config | The GRFConfig object to make a copy of. |
Definition at line 46 of file newgrf_config.cpp.
void GRFConfig::CopyParams | ( | const GRFConfig & | src | ) |
Copy the parameter information from the src config.
src | Source config. |
Definition at line 87 of file newgrf_config.cpp.
References num_params, and param.
Referenced by NewGRFWindow::UpgradeCurrent().
const char * GRFConfig::GetDescription | ( | ) | const |
Get the grf info.
Definition at line 108 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.
Definition at line 98 of file newgrf_config.cpp.
References filename, GetGRFStringFromGRFText(), name, and StrEmpty().
Referenced by GRFSorter(), NewGRFWindow::NameSorter(), ShowMissingContentWindow(), and ShowNewGrfVehicleError().
std::optional< std::string > GRFConfig::GetTextfile | ( | TextfileType | type | ) | const |
Search a textfile file next to this NewGRF.
type | The type of the textfile to search for. |
Definition at line 740 of file newgrf_config.cpp.
References filename, GetTextfile(), and NEWGRF_DIR.
const char * GRFConfig::GetURL | ( | ) | const |
Get the grf url.
Definition at line 117 of file newgrf_config.cpp.
References GetGRFStringFromGRFText(), and url.
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 141 of file newgrf_config.cpp.
References _settings_client, GRFP_GRF_DOS, GRFP_GRF_MASK, GRFP_GRF_WINDOWS, GRFP_USE_BIT, GRFP_USE_DOS, GRFP_USE_WINDOWS, ClientSettings::gui, GUISettings::newgrf_default_palette, PAL_DOS, PAL_WINDOWS, palette, and SB().
uint32_t GRFConfig::grf_bugs |
NOSAVE: bugs in this GRF in this run,.
Definition at line 165 of file newgrf_config.h.
Referenced by ShowNewGrfVehicleError(), and VehicleLengthChanged().