46enum GrfLoadingStage : uint8_t {
59 GMB_DESERT_TREES_FIELDS = 0,
60 GMB_DESERT_PAVED_ROADS = 1,
61 GMB_FIELD_BOUNDING_BOX = 2,
63 GMB_AMBIENT_SOUND_CALLBACK = 4,
64 GMB_CATENARY_ON_3RD_TRACK = 5,
65 GMB_SECOND_ROCKY_TILE_SET = 6,
98static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
105 GRFLabel(uint8_t label, uint32_t nfo_line,
size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {}
110 std::string filename;
117 std::vector<std::unique_ptr<struct StationSpec>> stations;
118 std::vector<std::unique_ptr<struct HouseSpec>> housespec;
119 std::vector<std::unique_ptr<struct IndustrySpec>> industryspec;
120 std::vector<std::unique_ptr<struct IndustryTileSpec>> indtspec;
121 std::vector<std::unique_ptr<struct ObjectSpec>> objectspec;
122 std::vector<std::unique_ptr<struct AirportSpec>> airportspec;
123 std::vector<std::unique_ptr<struct AirportTileSpec>> airtspec;
124 std::vector<std::unique_ptr<struct RoadStopSpec>> roadstops;
126 std::vector<uint32_t> param;
134 std::array<RailType, RAILTYPE_END> railtype_map{};
137 std::array<RoadType, ROADTYPE_END> roadtype_map{};
140 std::array<RoadType, ROADTYPE_END> tramtype_map{};
159 return (number < std::size(this->param)) ? this->param[number] : 0;
203void GrfMsgI(
int severity,
const std::string &msg);
204#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)
Helper types related to the allocation of memory.
Functions related to bit mathematics.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Types/functions related to cargoes.
Base class that provides memory initialization on dynamically created objects.
#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.
Functions related to memory operations.
uint8_t _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.
void ResetPersistentNewGRFData()
Reset NewGRF data which is stored persistently in savegames.
@ SHORE_REPLACE_ACTION_A
Shore sprites were replaced by ActionA (using grass tiles for the corner-shores).
@ SHORE_REPLACE_NONE
No shore sprites were replaced.
@ SHORE_REPLACE_ONLY_NEW
Only corner-shores were loaded by Action5 (openttd(w/d).grf only).
@ SHORE_REPLACE_ACTION_5
Shore sprites were replaced by Action5.
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
CanalFeature
List of different canal 'features'.
@ TRAMWAY_REPLACE_DEPOT_WITH_TRACK
Electrified depot graphics with tram track were loaded.
@ TRAMWAY_REPLACE_DEPOT_NO_TRACK
Electrified depot graphics without tram track were loaded.
@ TRAMWAY_REPLACE_DEPOT_NONE
No tram depot graphics 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 ...
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
void LoadNewGRF(SpriteID load_index, uint num_baseset)
Load all the NewGRFs.
void ResetNewGRFData()
Reset all NewGRF loaded data.
@ GSF_FAKE_TOWNS
Fake town GrfSpecFeature for NewGRF debugging (parent scope)
@ GSF_INVALID
An invalid spec feature.
@ GSF_FAKE_END
End of the fake features.
void GrfMsgI(int severity, const std::string &msg)
Debug() function dedicated to newGRF debugging messages Function is essentially the same as Debug(grf...
@ GMB_TRAIN_WIDTH_32_PIXELS
Use 32 pixels per train vehicle in depot gui and vehicle details. Never set in the global variable;.
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.
Callbacks that NewGRFs could implement.
Header of Action 04 "universal holder" structure.
The different types of rail.
Enums and other types related to roads.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
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< 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.
CanalProperties canal_local_properties[CF_END]
Canal properties as set by this NewGRF.
std::vector< RoadTypeLabel > roadtype_list
Roadtype translation table (road)
uint32_t grf_features
Bitset of GrfSpecFeature the grf uses.
std::vector< RoadTypeLabel > tramtype_list
Roadtype translation table (tram)
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.
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.
bool has_2CC
Set if any vehicle is loaded which uses 2cc (two company colours).
ShoreReplacement shore
In which way shore sprites were replaced.
uint64_t used_liveries
Bitmask of LiveryScheme used by the defined engines.
TramReplacement tram
In which way tram depots were replaced.