OpenTTD Source: GRFFile Struct Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Data Fields
GRFFile Struct Reference

Dynamic data of a loaded NewGRF. More...

`#include <newgrf.h>`

Inheritance diagram for GRFFile:

## Public Member Functions
| GRFFile (const struct GRFConfig *config)
| Constructor for GRFFile.
uint32_t | GetParam (uint number) const
| Get GRF Parameter with range checking.
Public Member Functions inherited from ZeroedMemoryAllocator
void * | operator new (size_t size)
| Memory allocator for a single class instance.
void * | operator new[] (size_t size)
| Memory allocator for an array of class instances.
void | operator delete (void *ptr)
| Memory release for a single class instance.
void | operator delete[] (void *ptr)
| Memory release for an array of class instances.

## Data Fields
std::string | filename
uint32_t | grfid
uint8_t | grf_version
uint | sound_offset
uint16_t | num_sounds
std::vector< std::unique_ptr< struct StationSpec > > | stations
std::vector< std::unique_ptr< struct HouseSpec > > | housespec
std::vector< std::unique_ptr< struct IndustrySpec > > | industryspec
std::vector< std::unique_ptr< struct IndustryTileSpec > > | indtspec
std::vector< std::unique_ptr< struct ObjectSpec > > | objectspec
std::vector< std::unique_ptr< struct AirportSpec > > | airportspec
std::vector< std::unique_ptr< struct AirportTileSpec > > | airtspec
std::vector< std::unique_ptr< struct RoadStopSpec > > | roadstops
std::vector< uint32_t > | param
std::vector< GRFLabel > | labels
| List of labels.
std::vector< CargoLabel > | cargo_list
| Cargo translation table (local ID -> label)
std::array< uint8_t, NUM_CARGO > | cargo_map {}
| Inverse cargo translation table (CargoID -> local ID)
std::vector< RailTypeLabel > | railtype_list
| Railtype translation table.
std::array< RailType, RAILTYPE_END > | railtype_map {}
std::vector< RoadTypeLabel > | roadtype_list
| Roadtype translation table (road)
std::array< RoadType, ROADTYPE_END > | roadtype_map {}
std::vector< RoadTypeLabel > | tramtype_list
| Roadtype translation table (tram)
std::array< RoadType, ROADTYPE_END > | tramtype_map {}
CanalProperties | canal_local_properties [CF_END]
| Canal properties as set by this NewGRF.
std::unordered_map< uint8_t, LanguageMap > | language_map
| Mappings related to the languages.
int | traininfo_vehicle_pitch
| Vertical offset for drawing train images in depot GUI and vehicle details.
uint | traininfo_vehicle_width
| Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details.
uint32_t | grf_features
| Bitset of GrfSpecFeature the grf uses.
PriceMultipliers | price_base_multipliers
| Price base multipliers as set by the grf.

## Detailed Description

Dynamic data of a loaded NewGRF.

Definition at line 108 of file newgrf.h.

## Constructor & Destructor Documentation

## ◆ GRFFile()

GRFFile::GRFFile | ( | const struct GRFConfig * | config | ) |

Constructor for GRFFile.

Parameters

  config | GRFConfig to copy name, grfid and parameters from.

Definition at line 8977 of file newgrf.cpp.

References GRFConfig::filename, GRFIdentifier::grfid, GRFConfig::ident, INVALID_RAILTYPE, INVALID_ROADTYPE, GRFConfig::param, price_base_multipliers, RAILTYPE_ELECTRIC, RAILTYPE_MAGLEV, RAILTYPE_MONO, RAILTYPE_RAIL, ROADTYPE_ROAD, ROADTYPE_TRAM, traininfo_vehicle_pitch, and traininfo_vehicle_width.

## Member Function Documentation

## ◆ GetParam()

uint32_t GRFFile::GetParam | ( | uint | number | ) | const
| inline

Get GRF Parameter with range checking.

Definition at line 154 of file newgrf.h.

Referenced by ParamSet().

## Field Documentation

## ◆ airportspec

std::vector<std::unique_ptr<struct AirportSpec> > GRFFile::airportspec

Definition at line 121 of file newgrf.h.

## ◆ airtspec

std::vector<std::unique_ptr<struct AirportTileSpec> > GRFFile::airtspec

Definition at line 122 of file newgrf.h.

## ◆ canal_local_properties

CanalProperties GRFFile::canal_local_properties[CF_END]

Canal properties as set by this NewGRF.

Definition at line 141 of file newgrf.h.

Referenced by CanalChangeInfo(), and FinaliseCanals().

## ◆ cargo_list

std::vector<CargoLabel> GRFFile::cargo_list

Cargo translation table (local ID -> label)

Definition at line 129 of file newgrf.h.

Referenced by CalculateRefitMasks(), GetCargoTranslation(), GetCargoTranslationTable(), and GlobalVarChangeInfo().

## ◆ cargo_map

std::array<uint8_t, NUM_CARGO> GRFFile::cargo_map {}

Inverse cargo translation table (CargoID -> local ID)

Definition at line 130 of file newgrf.h.

Referenced by BuildCargoTranslationMap(), CalculateRefitMasks(), GetAllCargoSuffixes(), GetCargoSuffix(), GetRefitCostFactor(), VehicleScopeResolver::GetVariable(), GenericScopeResolver::GetVariable(), and IndustryTemporarilyRefusesCargo().

## ◆ filename

std::string GRFFile::filename

Definition at line 109 of file newgrf.h.

## ◆ grf_features

uint32_t GRFFile::grf_features

Bitset of GrfSpecFeature the grf uses.

Definition at line 148 of file newgrf.h.

Referenced by FinalisePriceBaseMultipliers().

## ◆ grf_version

uint8_t GRFFile::grf_version

Definition at line 111 of file newgrf.h.

## ◆ grfid

uint32_t GRFFile::grfid

Definition at line 110 of file newgrf.h.

## ◆ housespec

std::vector<std::unique_ptr<struct HouseSpec> > GRFFile::housespec

Definition at line 117 of file newgrf.h.

## ◆ indtspec

std::vector<std::unique_ptr<struct IndustryTileSpec> > GRFFile::indtspec

Definition at line 119 of file newgrf.h.

## ◆ industryspec

std::vector<std::unique_ptr<struct IndustrySpec> > GRFFile::industryspec

Definition at line 118 of file newgrf.h.

## ◆ labels

std::vector<GRFLabel> GRFFile::labels

List of labels.

Definition at line 127 of file newgrf.h.

Referenced by ClearTemporaryNewGRFData(), and DefineGotoLabel().

## ◆ language_map

std::unordered_map<uint8_t, LanguageMap> GRFFile::language_map

Mappings related to the languages.

Definition at line 143 of file newgrf.h.

Referenced by LanguageMap::GetLanguageMap(), and GlobalVarChangeInfo().

## ◆ num_sounds

uint16_t GRFFile::num_sounds

Definition at line 114 of file newgrf.h.

## ◆ objectspec

std::vector<std::unique_ptr<struct ObjectSpec> > GRFFile::objectspec

Definition at line 120 of file newgrf.h.

## ◆ param

std::vector<uint32_t> GRFFile::param

Definition at line 125 of file newgrf.h.

## ◆ price_base_multipliers

PriceMultipliers GRFFile::price_base_multipliers

Price base multipliers as set by the grf.

Definition at line 149 of file newgrf.h.

Referenced by FinalisePriceBaseMultipliers(), GetPrice(), GlobalVarChangeInfo(), and GRFFile().

## ◆ railtype_list

std::vector<RailTypeLabel> GRFFile::railtype_list

Railtype translation table.

Definition at line 132 of file newgrf.h.

Referenced by GetRailTypeTranslation(), GetReverseRailTypeTranslation(), GlobalVarChangeInfo(), and RailVehicleChangeInfo().

## ◆ railtype_map

std::array<RailType, RAILTYPE_END> GRFFile::railtype_map {}

Definition at line 133 of file newgrf.h.

## ◆ roadstops

std::vector<std::unique_ptr<struct RoadStopSpec> > GRFFile::roadstops

Definition at line 123 of file newgrf.h.

## ◆ roadtype_list

std::vector<RoadTypeLabel> GRFFile::roadtype_list

Roadtype translation table (road)

Definition at line 135 of file newgrf.h.

Referenced by AfterLoadGRFs(), GetReverseRoadTypeTranslation(), GetRoadTypeTranslation(), and GlobalVarChangeInfo().

## ◆ roadtype_map

std::array<RoadType, ROADTYPE_END> GRFFile::roadtype_map {}

Definition at line 136 of file newgrf.h.

## ◆ sound_offset

uint GRFFile::sound_offset

Definition at line 113 of file newgrf.h.

## ◆ stations

std::vector<std::unique_ptr<struct StationSpec> > GRFFile::stations

Definition at line 116 of file newgrf.h.

## ◆ traininfo_vehicle_pitch

int GRFFile::traininfo_vehicle_pitch

Vertical offset for drawing train images in depot GUI and vehicle details.

Definition at line 145 of file newgrf.h.

Referenced by DrawTrainDetails(), Train::GetDisplayImageWidth(), GetGlobalVariable(), GRFFile(), and ParamSet().

## ◆ traininfo_vehicle_width

uint GRFFile::traininfo_vehicle_width

Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details.

Definition at line 146 of file newgrf.h.

Referenced by Train::GetDisplayImageWidth(), GetGlobalVariable(), GRFFile(), and ParamSet().

## ◆ tramtype_list

std::vector<RoadTypeLabel> GRFFile::tramtype_list

Roadtype translation table (tram)

Definition at line 138 of file newgrf.h.

Referenced by AfterLoadGRFs(), GetReverseRoadTypeTranslation(), GetRoadTypeTranslation(), and GlobalVarChangeInfo().

## ◆ tramtype_map

std::array<RoadType, ROADTYPE_END> GRFFile::tramtype_map {}

Definition at line 139 of file newgrf.h.

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

- src/newgrf.h
- src/newgrf.cpp