107static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
114 GRFLabel(uint8_t label, uint32_t nfo_line,
size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {}
119 std::string filename{};
121 uint8_t grf_version = 0;
123 uint sound_offset = 0;
124 uint16_t num_sounds = 0;
126 std::vector<std::unique_ptr<struct StationSpec>> stations;
127 std::vector<std::unique_ptr<struct HouseSpec>> housespec;
128 std::vector<std::unique_ptr<struct IndustrySpec>> industryspec;
129 std::vector<std::unique_ptr<struct IndustryTileSpec>> indtspec;
130 std::vector<std::unique_ptr<struct ObjectSpec>> objectspec;
131 std::vector<std::unique_ptr<struct AirportSpec>> airportspec;
132 std::vector<std::unique_ptr<struct AirportTileSpec>> airtspec;
133 std::vector<std::unique_ptr<struct RoadStopSpec>> roadstops;
135 std::vector<uint32_t> param{};
143 std::unordered_map<uint16_t, BadgeID> badge_map{};
146 std::array<RailType, RAILTYPE_END> railtype_map{};
149 std::array<RoadType, ROADTYPE_END> roadtype_map{};
152 std::array<RoadType, ROADTYPE_END> tramtype_map{};
179 return (number < std::size(this->param)) ? this->param[number] : 0;
236void GrfMsgI(
int severity,
const std::string &msg);
237#define GrfMsg(severity, format_string, ...) do { if ((severity) == 0 || _debug_grf_level >= (severity)) GrfMsgI(severity, fmt::format(FMT_STRING(format_string) __VA_OPT__(,) __VA_ARGS__)); } while (false)
Types/functions related to cargoes.
Global state for badge definitions.
PriceCategory
Categories of a price bases.
Price
Enumeration of all base prices for use with Prices.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Types for standard in/out file operations.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
GrfMiscBits _misc_grf_features
Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E.
bool GetGlobalVariable(uint8_t param, uint32_t *value, const GRFFile *grffile)
Reads a variable common to VarAction2 and Action7/9/D.
GrfLoadingStage
Stages of loading all NewGRFs.
@ SafetyScan
Checks whether the NewGRF can be used in a static context.
@ Reserve
Third step of NewGRF loading; reserve features and GRMs.
@ Init
Second step of NewGRF loading; load all actions into memory.
@ LabelScan
First step of NewGRF loading; find the 'goto' labels in the NewGRF.
@ Activation
Forth step of NewGRF loading; activate the features.
@ FileScan
Load the Action 8 metadata (GRF ID, name).
void ResetPersistentNewGRFData()
Reset NewGRF data which is stored persistently in savegames.
ShoreReplacement
Type of shore replacement loaded by NewGRFs.
@ None
No shore sprites were replaced.
@ Action5
Shore sprites were replaced by Action5.
@ ActionA
Shore sprites were replaced by ActionA (using grass tiles for the corner-shores).
@ OnlyNew
Only corner-shores were loaded by Action5 (openttd(w/d).grf only).
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
CanalFeature
List of different canal 'features'.
TramDepotReplacement
Type of tram depot replacement loaded by NewGRFs.
@ WithTrack
Electrified depot graphics with tram track were loaded.
@ WithoutTrack
Electrified depot graphics without tram track were loaded.
StringID MapGRFStringID(uint32_t grfid, GRFStringID str)
Used when setting an object's property to map to the GRF's strings while taking in consideration the ...
void LoadNewGRF(SpriteID load_index, uint num_baseset)
Load all the NewGRFs.
void ResetNewGRFData()
Reset all NewGRF loaded data.
GrfSpecFeature GetGrfSpecFeature(VehicleType type)
Get the GrfSpecFeature associated with a VehicleType.
@ RoadStops
Road stops feature.
@ FakeTowns
Fake town GrfSpecFeature for NewGRF debugging (parent scope).
@ SoundEffects
Sound effects feature.
@ Cargoes
Cargoes feature.
@ RoadVehicles
Road vehicles feature.
@ TramTypes
Tram types feature.
@ Invalid
An invalid spec feature.
@ FakeEnd
End of the fake features.
@ OriginalStrings
Pseudo unsupported 'feature' for replacing original strings.
@ Default
Unspecified feature, default badge.
@ Stations
Stations feature.
@ Airports
Airports feature.
@ GlobalVar
Global variables feature.
@ Bridges
Bridges feature.
@ IndustryTiles
Industry tiles feature.
@ Objects
Objects feature.
@ Signals
Signals feature.
@ Industries
Industries feature.
void GrfMsgI(int severity, const std::string &msg)
Debug() function dedicated to newGRF debugging messages Function is essentially the same as Debug(grf...
GrfMiscBit
Bits of NewGRF's GlobalVariable 1E/9E.
@ TrainWidth32Pixels
Use 32 pixels per train vehicle in depot gui and vehicle details. Never set in the global variable;.
@ SecondRockyTileSet
Enable using the second rocky tile set.
@ CatenaryOn3rdTrack
Unsupported: enable catenaries over third track type.
@ DesertTreesFields
Unsupported: allow trees and fields in desert climate.
@ AmbientSoundCallback
Enable ambient sound effect callback 144.
@ DesertPavedRoads
Show pavement and lights in desert towns.
@ FieldBoundingBox
Unsupported: fiels have a height.
void LoadNewGRFFile(GRFConfig &config, GrfLoadingStage stage, Subdirectory subdir, bool temporary)
Load a particular NewGRF.
void ShowNewGRFError()
Show the first NewGRF error we can find.
void ReloadNewGRFData()
Reload all NewGRF files during a running game.
VehicleType GetVehicleType(GrfSpecFeature feature)
Get the VehicleType associated with a GrfSpecFeature.
Types related to NewGRF badges.
Callbacks that NewGRFs could implement.
Header of Action 04 "universal holder" structure.
StrongType::Typedef< uint32_t, struct GRFStringIDTag, StrongType::Compare, StrongType::Integer > GRFStringID
Type for GRF-internal string IDs.
The different types of rail.
EnumBitSet< RailType, uint64_t > RailTypes
Allow incrementing of Track variables.
Enums and other types related to roads.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Aircraft, helicopters, rotors and their shadows belong to this class.
Canal properties local to the NewGRF.
CanalCallbackMasks callback_mask
Bitmask of canal callbacks that have to be called.
uint8_t flags
Flags controlling display.
Information about GRF, used in the game and (part of it) in savegames.
Dynamic data of a loaded NewGRF.
std::array< CanalProperties, CF_END > canal_local_properties
Canal properties as set by this NewGRF.
std::array< uint8_t, NUM_CARGO > cargo_map
Inverse cargo translation table (CargoType -> local ID).
std::vector< RailTypeLabel > railtype_list
Railtype translation table.
uint32_t GetParam(uint number) const
Get GRF Parameter with range checking.
std::vector< RoadTypeLabel > roadtype_list
Roadtype translation table (road).
bool cargo_list_is_fallback
Set if cargo types have been created but a cargo list has not been installed.
std::vector< RoadTypeLabel > tramtype_list
Roadtype translation table (tram).
GRFFile(const GRFConfig &config)
Constructor for GRFFile.
std::vector< CargoLabel > cargo_list
Cargo translation table (local ID -> label).
uint traininfo_vehicle_width
Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details.
std::vector< BadgeID > badge_list
Badge translation table (local index -> global index).
GrfSpecFeatures grf_features
Bitset of GrfSpecFeature the grf uses.
int traininfo_vehicle_pitch
Vertical offset for drawing train images in depot GUI and vehicle details.
std::unordered_map< uint8_t, LanguageMap > language_map
Mappings related to the languages.
std::vector< GRFLabel > labels
List of labels.
PriceMultipliers price_base_multipliers
Price base multipliers as set by the grf.
State of features loaded by NewGRFs.
bool has_2CC
Set if any vehicle is loaded which uses 2cc (two company colours).
TramDepotReplacement tram
In which way tram depots were replaced.
ShoreReplacement shore
In which way shore sprites were replaced.
uint64_t used_liveries
Bitmask of LiveryScheme used by the defined engines.
Describes properties of price bases.
Price fallback_price
Fallback price multiplier for new prices but old grfs.
PriceCategory category
Price is affected by certain difficulty settings.
Money start_price
Default value at game start, before adding multipliers.
GrfSpecFeature grf_feature
GRF Feature that decides whether price multipliers apply locally or globally, GrfSpecFeature::End if ...
Types related to vehicles.
VehicleType
Available vehicle types.