OpenTTD Source: src/newgrf.cpp File Reference

OpenTTD Source 14.0-beta3

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
newgrf.cpp File Reference
`#include "stdafx.h"`
`#include "core/container_func.hpp"`
`#include "debug.h"`
`#include "fileio_func.h"`
`#include "engine_func.h"`
`#include "engine_base.h"`
`#include "bridge.h"`
`#include "town.h"`
`#include "newgrf_engine.h"`
`#include "newgrf_text.h"`
`#include "fontcache.h"`
`#include "currency.h"`
`#include "landscape.h"`
`#include "newgrf_cargo.h"`
`#include "newgrf_house.h"`
`#include "newgrf_sound.h"`
`#include "newgrf_station.h"`
`#include "industrytype.h"`
`#include "industry_map.h"`
`#include "newgrf_canal.h"`
`#include "newgrf_townname.h"`
`#include "newgrf_industries.h"`
`#include "newgrf_airporttiles.h"`
`#include "newgrf_airport.h"`
`#include "newgrf_object.h"`
`#include "rev.h"`
`#include "fios.h"`
`#include "strings_func.h"`
`#include "timer/timer_game_tick.h"`
`#include "timer/timer_game_calendar.h"`
`#include "string_func.h"`
`#include "network/core/config.h"`
`#include "smallmap_gui.h"`
`#include "genworld.h"`
`#include "error.h"`
`#include "error_func.h"`
`#include "vehicle_func.h"`
`#include "language.h"`
`#include "vehicle_base.h"`
`#include "road.h"`
`#include "newgrf_roadstop.h"`
`#include "table/strings.h"`
`#include "table/build_industry.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | GrfProcessingState
| Temporary data during loading of GRFs. More...
struct | GrfProcessingState::SpriteSet
| Definition of a single Action1 spriteset. More...
class | OTTDByteReaderSignal
class | ByteReader
| Class to read from a NewGRF file. More...
struct | GRFTempEngineData
| Temporary engine data used when loading only. More...
struct | GRFLocation
struct | StringIDMapping
| Information for mapping static StringIDs. More...
struct | Action5Type
| Information about a single action 5 type. More...
struct | AllowedSubtags
| Data structure to store the allowed id/type combinations for action 14. More...

## Macros
#define | TEXTID_TO_STRINGID(begin, end, stringid, stringend)

## Typedefs
typedef void(* | SpecialSpriteHandler) (ByteReader *buf)
typedef std::map< GRFLocation, std::vector< byte > > | GRFLineToSpriteOverride
typedef std::vector< StringIDMapping > | StringIDMappingVector
typedef ChangeInfoResult(* | VCI_Handler) (uint engine, int numinfo, int prop, ByteReader *buf)
typedef bool(* | DataHandler) (size_t, ByteReader *)
| Type of callback function for binary nodes.
typedef bool(* | TextHandler) (byte, const char *str)
| Type of callback function for text nodes.
typedef bool(* | BranchHandler) (ByteReader *)
| Type of callback function for branch nodes.

## Enumerations
enum | ChangeInfoResult { CIR_SUCCESS, CIR_DISABLED, CIR_UNHANDLED, CIR_UNKNOWN, CIR_INVALID_ID }
| Possible return values for the FeatureChangeInfo functions. More...
enum | Action5BlockType { A5BLOCK_FIXED, A5BLOCK_ALLOW_OFFSET, A5BLOCK_INVALID }
| The type of action 5 type. More...

## Functions
const std::vector< GRFFile * > & | GetAllGRFFiles ()
template<VehicleType T>
static bool | IsValidNewGRFImageIndex (uint8_t image_index)
| Helper to check whether an image index is valid for a particular NewGRF vehicle. More...
void | GrfMsgI (int severity, const std::string &msg)
| Debug() function dedicated to newGRF debugging messages Function is essentially the same as Debug(grf, severity, ...) with the addition of file:line information when parsing grf files. More...
static GRFFile * | GetFileByGRFID (uint32_t grfid)
| Obtain a NewGRF file by its grfID. More...
static GRFFile * | GetFileByFilename (const std::string &filename)
| Obtain a NewGRF file by its filename. More...
static void | ClearTemporaryNewGRFData (GRFFile *gf)
| Reset all NewGRFData that was used only while processing data.
static GRFError * | DisableGrf (StringID message=STR_NULL, GRFConfig *config=nullptr)
| Disable a GRF. More...
static void | AddStringForMapping (StringID source, StringID *target)
| Record a static StringID for getting translated later. More...
static StringID | TTDPStringIDToOTTDStringIDMapping (StringID str)
| Perform a mapping from TTDPatch's string IDs to OpenTTD's string IDs, but only for the ones we are aware off; the rest like likely unused and will show a warning. More...
StringID | MapGRFStringID (uint32_t grfid, StringID str)
| Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one. More...
static void | SetNewGRFOverride (uint32_t source_grfid, uint32_t target_grfid)
| Set the override for a NewGRF. More...
static Engine * | GetNewEngine (const GRFFile *file, VehicleType type, uint16_t internal_id, bool static_access=false)
| Returns the engine associated to a certain internal_id, resp. More...
EngineID | GetNewEngineID (const GRFFile *file, VehicleType type, uint16_t internal_id)
| Return the ID of a new engine. More...
static void | MapSpriteMappingRecolour (PalSpriteID *grf_sprite)
| Map the colour modifiers of TTDPatch to those that Open is using. More...
static TileLayoutFlags | ReadSpriteLayoutSprite (ByteReader *buf, bool read_flags, bool invert_action1_flag, bool use_cur_spritesets, int feature, PalSpriteID *grf_sprite, uint16_t *max_sprite_offset=nullptr, uint16_t *max_palette_offset=nullptr)
| Read a sprite and a palette from the GRF and convert them into a format suitable to OpenTTD. More...
static void | ReadSpriteLayoutRegisters (ByteReader *buf, TileLayoutFlags flags, bool is_parent, NewGRFSpriteLayout *dts, uint index)
| Preprocess the TileLayoutFlags and read register modifiers from the GRF. More...
static bool | ReadSpriteLayout (ByteReader *buf, uint num_building_sprites, bool use_cur_spritesets, byte feature, bool allow_var10, bool no_z_position, NewGRFSpriteLayout *dts)
| Read a spritelayout from the GRF. More...
static CargoTypes | TranslateRefitMask (uint32_t refit_mask)
| Translate the refit mask. More...
static void | ConvertTTDBasePrice (uint32_t base_pointer, const char *error_location, Price *index)
| Converts TTD(P) Base Price pointers into the enum used by OTTD See http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts. More...
static ChangeInfoResult | CommonVehicleChangeInfo (EngineInfo *ei, int prop, ByteReader *buf)
| Define properties common to all vehicles. More...
static ChangeInfoResult | RailVehicleChangeInfo (uint engine, int numinfo, int prop, ByteReader *buf)
| Define properties for rail vehicles. More...
static ChangeInfoResult | RoadVehicleChangeInfo (uint engine, int numinfo, int prop, ByteReader *buf)
| Define properties for road vehicles. More...
static ChangeInfoResult | ShipVehicleChangeInfo (uint engine, int numinfo, int prop, ByteReader *buf)
| Define properties for ships. More...
static ChangeInfoResult | AircraftVehicleChangeInfo (uint engine, int numinfo, int prop, ByteReader *buf)
| Define properties for aircraft. More...
static ChangeInfoResult | StationChangeInfo (uint stid, int numinfo, int prop, ByteReader *buf)
| Define properties for stations. More...
static ChangeInfoResult | CanalChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
| Define properties for water features. More...
static ChangeInfoResult | BridgeChangeInfo (uint brid, int numinfo, int prop, ByteReader *buf)
| Define properties for bridges. More...
static ChangeInfoResult | IgnoreTownHouseProperty (int prop, ByteReader *buf)
| Ignore a house property. More...
static ChangeInfoResult | TownHouseChangeInfo (uint hid, int numinfo, int prop, ByteReader *buf)
| Define properties for houses. More...
template<typename T >
static ChangeInfoResult | LoadTranslationTable (uint gvid, int numinfo, ByteReader *buf, std::vector< T > &translation_table, const char *name)
| Load a cargo- or railtype-translation table. More...
static std::string | ReadDWordAsString (ByteReader *reader)
| Helper to read a DWord worth of bytes from the reader and to return it as a valid string. More...
static ChangeInfoResult | GlobalVarChangeInfo (uint gvid, int numinfo, int prop, ByteReader *buf)
| Define properties for global variables. More...
static ChangeInfoResult | GlobalVarReserveInfo (uint gvid, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | CargoChangeInfo (uint cid, int numinfo, int prop, ByteReader *buf)
| Define properties for cargoes. More...
static ChangeInfoResult | SoundEffectChangeInfo (uint sid, int numinfo, int prop, ByteReader *buf)
| Define properties for sound effects. More...
static ChangeInfoResult | IgnoreIndustryTileProperty (int prop, ByteReader *buf)
| Ignore an industry tile property. More...
static ChangeInfoResult | IndustrytilesChangeInfo (uint indtid, int numinfo, int prop, ByteReader *buf)
| Define properties for industry tiles. More...
static ChangeInfoResult | IgnoreIndustryProperty (int prop, ByteReader *buf)
| Ignore an industry property. More...
static bool | ValidateIndustryLayout (const IndustryTileLayout &layout)
| Validate the industry layout; e.g. More...
static ChangeInfoResult | IndustriesChangeInfo (uint indid, int numinfo, int prop, ByteReader *buf)
| Define properties for industries. More...
static void | DuplicateTileTable (AirportSpec *as)
| Create a copy of the tile table so it can be freed later without problems. More...
static ChangeInfoResult | AirportChangeInfo (uint airport, int numinfo, int prop, ByteReader *buf)
| Define properties for airports. More...
static ChangeInfoResult | IgnoreObjectProperty (uint prop, ByteReader *buf)
| Ignore properties for objects. More...
static ChangeInfoResult | ObjectChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
| Define properties for objects. More...
static ChangeInfoResult | RailTypeChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
| Define properties for railtypes. More...
static ChangeInfoResult | RailTypeReserveInfo (uint id, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | RoadTypeChangeInfo (uint id, int numinfo, int prop, ByteReader *buf, RoadTramType rtt)
| Define properties for roadtypes. More...
static ChangeInfoResult | RoadTypeChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | TramTypeChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | RoadTypeReserveInfo (uint id, int numinfo, int prop, ByteReader *buf, RoadTramType rtt)
static ChangeInfoResult | RoadTypeReserveInfo (uint id, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | TramTypeReserveInfo (uint id, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | AirportTilesChangeInfo (uint airtid, int numinfo, int prop, ByteReader *buf)
static ChangeInfoResult | IgnoreRoadStopProperty (uint prop, ByteReader *buf)
| Ignore properties for roadstops. More...
static ChangeInfoResult | RoadStopChangeInfo (uint id, int numinfo, int prop, ByteReader *buf)
static bool | HandleChangeInfoResult (const char *caller, ChangeInfoResult cir, uint8_t feature, uint8_t property)
static void | FeatureChangeInfo (ByteReader *buf)
static void | SafeChangeInfo (ByteReader *buf)
static void | ReserveChangeInfo (ByteReader *buf)
static void | NewSpriteSet (ByteReader *buf)
static void | SkipAct1 (ByteReader *buf)
static const SpriteGroup * | GetGroupFromGroupID (byte setid, byte type, uint16_t groupid)
static const SpriteGroup * | CreateGroupFromGroupID (byte feature, byte setid, byte type, uint16_t spriteid)
| Helper function to either create a callback or a result sprite group. More...
static void | NewSpriteGroup (ByteReader *buf)
static CargoID | TranslateCargo (uint8_t feature, uint8_t ctype)
static bool | IsValidGroupID (uint16_t groupid, const char *function)
static void | VehicleMapSpriteGroup (ByteReader *buf, byte feature, uint8_t idcount)
static void | CanalMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | StationMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | TownHouseMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | IndustryMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | IndustrytileMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | CargoMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | ObjectMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | RailTypeMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | RoadTypeMapSpriteGroup (ByteReader *buf, uint8_t idcount, RoadTramType rtt)
static void | AirportMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | AirportTileMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | RoadStopMapSpriteGroup (ByteReader *buf, uint8_t idcount)
static void | FeatureMapSpriteGroup (ByteReader *buf)
static void | FeatureNewName (ByteReader *buf)
static uint16_t | SanitizeSpriteOffset (uint16_t &num, uint16_t offset, int max_sprites, const char *name)
| Sanitize incoming sprite offsets for Action 5 graphics replacements. More...
static void | GraphicsNew (ByteReader *buf)
static void | SkipAct5 (ByteReader *buf)
bool | GetGlobalVariable (byte param, uint32_t *value, const GRFFile *grffile)
| Reads a variable common to VarAction2 and Action7/9/D. More...
static uint32_t | GetParamVal (byte param, uint32_t *cond_val)
static void | CfgApply (ByteReader *buf)
static void | DisableStaticNewGRFInfluencingNonStaticNewGRFs (GRFConfig *c)
| Disable a static NewGRF when it is influencing another (non-static) NewGRF as this could cause desyncs. More...
static void | SkipIf (ByteReader *buf)
static void | ScanInfo (ByteReader *buf)
static void | GRFInfo (ByteReader *buf)
static void | SpriteReplace (ByteReader *buf)
static void | SkipActA (ByteReader *buf)
static void | GRFLoadError (ByteReader *buf)
static void | GRFComment (ByteReader *buf)
static void | SafeParamSet (ByteReader *buf)
static uint32_t | GetPatchVariable (uint8_t param)
static uint32_t | PerformGRM (uint32_t *grm, uint16_t num_ids, uint16_t count, uint8_t op, uint8_t target, const char *type)
static void | ParamSet (ByteReader *buf)
| Action 0x0D: Set parameter.
static void | SafeGRFInhibit (ByteReader *buf)
static void | GRFInhibit (ByteReader *buf)
static void | FeatureTownName (ByteReader *buf)
| Action 0x0F - Define Town names.
static void | DefineGotoLabel (ByteReader *buf)
| Action 0x10 - Define goto label.
static void | ImportGRFSound (SoundEntry *sound)
| Process a sound import from another GRF file. More...
static void | LoadGRFSound (size_t offs, SoundEntry *sound)
| Load a sound from a file. More...
static void | GRFSound (ByteReader *buf)
static void | SkipAct11 (ByteReader *buf)
static void | LoadFontGlyph (ByteReader *buf)
| Action 0x12.
static void | SkipAct12 (ByteReader *buf)
| Action 0x12 (SKIP)
static void | TranslateGRFStrings (ByteReader *buf)
| Action 0x13.
static bool | ChangeGRFName (byte langid, const char *str)
| Callback function for 'INFO'->'NAME' to add a translation to the newgrf name.
static bool | ChangeGRFDescription (byte langid, const char *str)
| Callback function for 'INFO'->'DESC' to add a translation to the newgrf description.
static bool | ChangeGRFURL (byte langid, const char *str)
| Callback function for 'INFO'->'URL_' to set the newgrf url.
static bool | ChangeGRFNumUsedParams (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'NPAR' to set the number of valid parameters.
static bool | ChangeGRFPalette (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'PALS' to set the number of valid parameters.
static bool | ChangeGRFBlitter (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'BLTR' to set the blitter info.
static bool | ChangeGRFVersion (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'VRSN' to the version of the NewGRF.
static bool | ChangeGRFMinVersion (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'MINV' to the minimum compatible version of the NewGRF.
static bool | ChangeGRFParamName (byte langid, const char *str)
| Callback function for 'INFO'->'PARAM'->param_num->'NAME' to set the name of a parameter.
static bool | ChangeGRFParamDescription (byte langid, const char *str)
| Callback function for 'INFO'->'PARAM'->param_num->'DESC' to set the description of a parameter.
static bool | ChangeGRFParamType (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'PARAM'->param_num->'TYPE' to set the typeof a parameter.
static bool | ChangeGRFParamLimits (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'PARAM'->param_num->'LIMI' to set the min/max value of a parameter.
static bool | ChangeGRFParamMask (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'PARAM'->param_num->'MASK' to set the parameter and bits to use.
static bool | ChangeGRFParamDefault (size_t len, ByteReader *buf)
| Callback function for 'INFO'->'PARAM'->param_num->'DFLT' to set the default value.
static bool | SkipUnknownInfo (ByteReader *buf, byte type)
| Try to skip the current node and all subnodes (if it's a branch node). More...
static bool | HandleNodes (ByteReader *buf, AllowedSubtags *tags)
static bool | ChangeGRFParamValueNames (ByteReader *buf)
| Callback function for 'INFO'->'PARA'->param_num->'VALU' to set the names of some parameter values (type uint/enum) or the names of some bits (type bitmask). More...
static bool | HandleParameterInfo (ByteReader *buf)
| Callback function for 'INFO'->'PARA' to set extra information about the parameters. More...
static bool | HandleNode (byte type, uint32_t id, ByteReader *buf, AllowedSubtags subtags[])
| Handle the nodes of an Action14. More...
static bool | HandleNodes (ByteReader *buf, AllowedSubtags subtags[])
| Handle the contents of a 'C' choice of an Action14. More...
static void | StaticGRFInfo (ByteReader *buf)
| Handle Action 0x14. More...
static void | GRFUnsafe (ByteReader *)
| Set the current NewGRF as unsafe for static use. More...
static void | InitializeGRFSpecial ()
| Initialize the TTDPatch flags.
static void | ResetCustomStations ()
| Reset and clear all NewGRF stations.
static void | ResetCustomHouses ()
| Reset and clear all NewGRF houses.
static void | ResetCustomAirports ()
| Reset and clear all NewGRF airports.
static void | ResetCustomIndustries ()
| Reset and clear all NewGRF industries.
static void | ResetCustomObjects ()
| Reset and clear all NewObjects.
static void | ResetCustomRoadStops ()
static void | ResetNewGRF ()
| Reset and clear all NewGRFs.
static void | ResetNewGRFErrors ()
| Clear all NewGRF errors.
void | ResetNewGRFData ()
| Reset all NewGRF loaded data.
void | ResetPersistentNewGRFData ()
| Reset NewGRF data which is stored persistently in savegames.
static void | BuildCargoTranslationMap ()
| Construct the Cargo Mapping. More...
static void | InitNewGRFFile (const GRFConfig *config)
| Prepare loading a NewGRF file with its config. More...
static CargoLabel | GetActiveCargoLabel (const std::initializer_list< CargoLabel > &labels)
| Find first cargo label that exists and is active from a list of cargo labels. More...
static CargoLabel | GetActiveCargoLabel (const std::variant< CargoLabel, MixedCargoType > &label)
| Get active cargo label from either a cargo label or climate-dependent mixed cargo type. More...
static void | CalculateRefitMasks ()
| Precalculate refit masks from cargo classes for all vehicles. More...
static void | FinaliseCanals ()
| Set to use the correct action0 properties for each canal feature.
static void | FinaliseEngineArray ()
| Check for invalid engines.
void | FinaliseCargoArray ()
| Check for invalid cargoes.
static bool | IsHouseSpecValid (HouseSpec *hs, const HouseSpec *next1, const HouseSpec *next2, const HouseSpec *next3, const std::string &filename)
| Check if a given housespec is valid and disable it if it's not. More...
static void | EnsureEarlyHouse (HouseZones bitmask)
| Make sure there is at least one house available in the year 0 for the given climate / housezone combination. More...
static void | FinaliseHouseArray ()
| Add all new houses to the house array. More...
static void | FinaliseIndustriesArray ()
| Add all new industries to the industry array. More...
static void | FinaliseObjectsArray ()
| Add all new objects to the object array. More...
static void | FinaliseAirportsArray ()
| Add all new airports to the airport array. More...
static void | DecodeSpecialSprite (byte *buf, uint num, GrfLoadingStage stage)
static void | LoadNewGRFFileFromFile (GRFConfig *config, GrfLoadingStage stage, SpriteFile &file)
| Load a particular NewGRF from a SpriteFile. More...
void | LoadNewGRFFile (GRFConfig *config, GrfLoadingStage stage, Subdirectory subdir, bool temporary)
| Load a particular NewGRF. More...
static void | ActivateOldShore ()
| Relocates the old shore sprites at new positions. More...
static void | ActivateOldTramDepot ()
| Replocate the old tram depot sprites to the new position, if no new ones were loaded.
static void | FinalisePriceBaseMultipliers ()
| Decide whether price base multipliers of grfs shall apply globally or only to the grf specifying them. More...
void | InitGRFTownGeneratorNames ()
| Allocate memory for the NewGRF town names.
static void | AfterLoadGRFs ()
| Finish loading NewGRFs and execute needed post-processing.
void | LoadNewGRF (uint load_index, uint num_baseset)
| Load all the NewGRFs. More...

## Variables
static std::vector< GRFFile * > | _grf_files
| List of all loaded GRF files.
byte | _misc_grf_features = 0
| Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E.
static uint32_t | _ttdpatch_flags [8]
| 32 * 8 = 256 flags. More...
GRFLoadedFeatures | _loaded_newgrf_features
| Indicates which are the newgrf features currently loaded ingame.
static const uint | MAX_SPRITEGROUP = UINT8_MAX
| Maximum GRF-local ID for a spritegroup.
static GrfProcessingState | _cur
static const uint | NUM_STATIONS_PER_GRF = UINT16_MAX - 1
| The maximum amount of stations a single GRF is allowed to add.
static std::vector< GRFTempEngineData > | _gted
| Temporary engine data used during NewGRF loading.
static uint32_t | _grm_engines [256]
| Contains the GRF ID of the owner of a vehicle if it has been reserved. More...
static uint32_t | _grm_cargoes [NUM_CARGO *2]
| Contains the GRF ID of the owner of a cargo if it has been reserved.
static std::map< GRFLocation, SpriteID > | _grm_sprites
static GRFLineToSpriteOverride | _grf_line_to_action6_sprite_override
static StringIDMappingVector | _string_to_grf_mapping
static std::map< uint32_t, uint32_t > | _grf_id_overrides
static const Action5Type | _action5_types []
| The information about action 5 types. More...
static GRFParameterInfo * | _cur_parameter
| The parameter which info is currently changed by the newgrf.
AllowedSubtags | _tags_parameters []
| Action14 parameter tags. More...
AllowedSubtags | _tags_info []
| Action14 tags for the INFO node. More...
AllowedSubtags | _tags_root []
| Action14 root tags. More...

## Detailed Description

Base of all NewGRF support.

Definition in file newgrf.cpp.

## Macro Definition Documentation

## ◆ TEXTID_TO_STRINGID

#define TEXTID_TO_STRINGID | ( |  | begin,
|  |  | end,
|  |  | stringid,
|  |  | stringend
| ) |  |

Value:
static_assert(stringend - stringid == end - begin); \
if (str >= begin && str <= end) return str + (stringid - begin)

## Enumeration Type Documentation

## ◆ Action5BlockType

enum Action5BlockType

The type of action 5 type.

Enumerator
A5BLOCK_FIXED | Only allow replacing a whole block of sprites. (TTDP compatible)
A5BLOCK_ALLOW_OFFSET | Allow replacing any subset by specifiing an offset.
A5BLOCK_INVALID | unknown/not-implemented type

Definition at line 6390 of file newgrf.cpp.

## ◆ ChangeInfoResult

enum ChangeInfoResult

Possible return values for the FeatureChangeInfo functions.

Enumerator
CIR_SUCCESS | Variable was parsed and read.
CIR_DISABLED | GRF was disabled due to error.
CIR_UNHANDLED | Variable was parsed but unread.
CIR_UNKNOWN | Variable is unknown.
CIR_INVALID_ID | Attempt to modify an invalid ID.

Definition at line 978 of file newgrf.cpp.

## Function Documentation

## ◆ ActivateOldShore()

static void ActivateOldShore | ( |  | ) |
| static

Relocates the old shore sprites at new positions.

1. If shore sprites are neither loaded by Action5 nor ActionA, the extra sprites from openttd(w/d).grf are used. (SHORE_REPLACE_ONLY_NEW)
2. If a newgrf replaces some shore sprites by ActionA. The (maybe also replaced) grass tiles are used for corner shores. (SHORE_REPLACE_ACTION_A)
3. If a newgrf replaces shore sprites by Action5 any shore replacement by ActionA has no effect. (SHORE_REPLACE_ACTION_5)

Definition at line 9753 of file newgrf.cpp.

References _loaded_newgrf_features, GRFLoadedFeatures::shore, SHORE_REPLACE_ACTION_5, SHORE_REPLACE_ACTION_A, and SHORE_REPLACE_NONE.

## ◆ AddStringForMapping()

static void AddStringForMapping | ( | StringID | source,
|  | StringID * | target
| ) |  |
| static

Record a static StringID for getting translated later.

Parameters

  source | Source StringID (GRF local).
  target | Destination for the mapping result.

Definition at line 473 of file newgrf.cpp.

## ◆ AircraftVehicleChangeInfo()

static ChangeInfoResult AircraftVehicleChangeInfo | ( | uint | engine,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for aircraft.

Parameters

  engine | Local ID of the aircraft.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 1745 of file newgrf.cpp.

References CIR_SUCCESS, and GetNewEngine().

## ◆ AirportChangeInfo()

static ChangeInfoResult AirportChangeInfo | ( | uint | airport,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for airports.

Parameters

  airport | Local ID of the airport.
  numinfo | Number of subsequent airport IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3893 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_AIRPORTS_PER_GRF.

## ◆ BridgeChangeInfo()

static ChangeInfoResult BridgeChangeInfo | ( | uint | brid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for bridges.

Parameters

  brid | BridgeID of the bridge.
  numinfo | Number of subsequent bridgeIDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 2195 of file newgrf.cpp.

References CIR_SUCCESS, and MAX_BRIDGES.

## ◆ BuildCargoTranslationMap()

static void BuildCargoTranslationMap | ( |  | ) |
| static

Construct the Cargo Mapping.

Note
  This is the reverse of a cargo translation table

Definition at line 8886 of file newgrf.cpp.

## ◆ CalculateRefitMasks()

static void CalculateRefitMasks | ( |  | ) |
| static

Precalculate refit masks from cargo classes for all vehicles.

< Set if the vehicle shall carry only the default cargo

Definition at line 9001 of file newgrf.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsDefaultCargo(), IsValidCargoID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Iterate(), NUM_CARGO, and SetBit().

## ◆ CanalChangeInfo()

static ChangeInfoResult CanalChangeInfo | ( | uint | id,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for water features.

Parameters

  id | Type of the first water feature.
  numinfo | Number of subsequent water feature ids to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 2157 of file newgrf.cpp.

References CIR_SUCCESS.

## ◆ CargoChangeInfo()

static ChangeInfoResult CargoChangeInfo | ( | uint | cid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for cargoes.

Parameters

  cid | Local ID of the cargo.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 2978 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_CARGO.

## ◆ ChangeGRFParamValueNames()

static bool ChangeGRFParamValueNames | ( | ByteReader * | buf | ) |
| static

Callback function for 'INFO'->'PARA'->param_num->'VALU' to set the names of some parameter values (type uint/enum) or the names of some bits (type bitmask).

In both cases the format is the same: Each subnode should be a text node with the value/bit number as id.

Definition at line 8389 of file newgrf.cpp.

References _cur_parameter, and GRFParameterInfo::max_value.

## ◆ CommonVehicleChangeInfo()

static ChangeInfoResult CommonVehicleChangeInfo | ( | EngineInfo * | ei,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties common to all vehicles.

Parameters

  ei | Engine info.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 995 of file newgrf.cpp.

References EngineInfo::base_intro, EngineInfo::base_life, CIR_SUCCESS, CIR_UNKNOWN, EngineInfo::climates, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, EngineInfo::lifelength, and PROP_VEHICLE_LOAD_AMOUNT.

## ◆ ConvertTTDBasePrice()

static void ConvertTTDBasePrice | ( | uint32_t | base_pointer,
|  | const char * | error_location,
|  | Price * | index
| ) |  |
| static

Converts TTD(P) Base Price pointers into the enum used by OTTD See http://wiki.ttdpatch.net/tiki-index.php?page=BaseCosts.

Parameters

  | base_pointer | TTD(P) Base Price Pointer
  | error_location | Function name for grf error messages
  [out] | index | If base_pointer is valid, index is assigned to the matching price; else it is left unchanged

< Position of first base price

< Size of each base price record

Definition at line 958 of file newgrf.cpp.

## ◆ CreateGroupFromGroupID()

static const SpriteGroup* CreateGroupFromGroupID | ( | byte | feature,
|  | byte | setid,
|  | byte | type,
|  | uint16_t | spriteid
| ) |  |
| static

Helper function to either create a callback or a result sprite group.

Parameters

  feature | GrfSpecFeature to define spritegroup for.
  setid | SetID of the currently being parsed Action2. (only for debug output)
  type | Type of the currently being parsed Action2. (only for debug output)
  spriteid | Raw value from the GRF for the new spritegroup; describes either the return value or the referenced spritegroup.

Returns
  Created spritegroup.

Definition at line 5163 of file newgrf.cpp.

## ◆ DisableGrf()

static GRFError* DisableGrf | ( | StringID | message = `STR_NULL`,
|  | GRFConfig * | config = `nullptr`
| ) |  |
| static

Disable a GRF.

Parameters

  message | Error message or STR_NULL.
  config | GRFConfig to disable, nullptr for current.

Returns
  Error message of the GRF for further customisation.

Definition at line 436 of file newgrf.cpp.

References GetFileByGRFID().

Referenced by DisableStaticNewGRFInfluencingNonStaticNewGRFs().

## ◆ DisableStaticNewGRFInfluencingNonStaticNewGRFs()

static void DisableStaticNewGRFInfluencingNonStaticNewGRFs | ( | GRFConfig * | c | ) |
| static

Disable a static NewGRF when it is influencing another (non-static) NewGRF as this could cause desyncs.

We could just tell the NewGRF querying that the file doesn't exist, but that might give unwanted results. Disabling the NewGRF gives the best result as no NewGRF author can complain about that.

Parameters

  c | The NewGRF to disable.

Definition at line 6824 of file newgrf.cpp.

References GRFError::data, and DisableGrf().

## ◆ DuplicateTileTable()

static void DuplicateTileTable | ( | AirportSpec * | as | ) |
| static

Create a copy of the tile table so it can be freed later without problems.

Parameters

  as | The AirportSpec to copy the arrays of.

Definition at line 3864 of file newgrf.cpp.

References AirportSpec::depot_table, MemCpyT(), AirportSpec::nof_depots, AirportSpec::num_table, AirportSpec::rotation, and AirportSpec::table.

## ◆ EnsureEarlyHouse()

static void EnsureEarlyHouse | ( | HouseZones | bitmask | ) |
| static

Make sure there is at least one house available in the year 0 for the given climate / housezone combination.

Parameters

  bitmask | The climate and housezone to check for. Exactly one climate bit and one housezone bit should be set.

Definition at line 9324 of file newgrf.cpp.

References HouseSpec::building_availability, HouseSpec::enabled, TimerGameConst< struct Calendar >::MAX_YEAR, HouseSpec::min_year, and NUM_HOUSES.

## ◆ FinaliseAirportsArray()

static void FinaliseAirportsArray | ( |  | ) |
| static

Add all new airports to the airport array.

Airport properties can be set at any time in the GRF file, so we can only add a airport spec to the airport array after the file has finished loading.

Definition at line 9521 of file newgrf.cpp.

References _grf_files, and AirportSpec::enabled.

## ◆ FinaliseHouseArray()

static void FinaliseHouseArray | ( |  | ) |
| static

Add all new houses to the house array.

House properties can be set at any time in the GRF file, so we can only add a house spec to the house array after the file has finished loading. We also need to check the dates, due to the TTDPatch behaviour described below that we need to emulate.

Definition at line 9351 of file newgrf.cpp.

References _grf_files, RandomAccessFile::filename, and IsHouseSpecValid().

## ◆ FinaliseIndustriesArray()

static void FinaliseIndustriesArray | ( |  | ) |
| static

Add all new industries to the industry array.

Industry properties can be set at any time in the GRF file, so we can only add a industry spec to the industry array after the file has finished loading.

Definition at line 9429 of file newgrf.cpp.

References _grf_files, IndustrySpec::closure_text, IndustrySpec::enabled, GetGRFStringID(), IndustrySpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, IndustrySpec::name, IndustrySpec::new_industry_text, IndustrySpec::production_down_text, IndustrySpec::production_up_text, and IndustrySpec::station_name.

## ◆ FinaliseObjectsArray()

static void FinaliseObjectsArray | ( |  | ) |
| static

Add all new objects to the object array.

Object properties can be set at any time in the GRF file, so we can only add an object spec to the object array after the file has finished loading.

Definition at line 9503 of file newgrf.cpp.

References _grf_files, _object_mngr, ObjectSpec::BindToClasses(), and ObjectOverrideManager::SetEntitySpec().

## ◆ FinalisePriceBaseMultipliers()

static void FinalisePriceBaseMultipliers | ( |  | ) |
| static

Decide whether price base multipliers of grfs shall apply globally or only to the grf specifying them.

Features, to which '_grf_id_overrides' applies. Currently vehicle features only.

Definition at line 9805 of file newgrf.cpp.

## ◆ GetActiveCargoLabel() [1/2]

static CargoLabel GetActiveCargoLabel | ( | const std::initializer_list< CargoLabel > & | labels | ) |
| static

Find first cargo label that exists and is active from a list of cargo labels.

Parameters

  labels | List of cargo labels.

Returns
  First cargo label in list that exists, or CT_INVALID if none exist.

Definition at line 8970 of file newgrf.cpp.

Referenced by GetActiveCargoLabel().

## ◆ GetActiveCargoLabel() [2/2]

static CargoLabel GetActiveCargoLabel | ( | const std::variant< CargoLabel, MixedCargoType > & | label | ) |
| static

Get active cargo label from either a cargo label or climate-dependent mixed cargo type.

Parameters

  label | Cargo label or climate-dependent mixed cargo type.

Returns
  Active cargo label, or CT_INVALID if cargo label is not active.

Definition at line 8984 of file newgrf.cpp.

References GetActiveCargoLabel(), and MCT_LIVESTOCK_FRUIT.

## ◆ GetFileByFilename()

static GRFFile* GetFileByFilename | ( | const std::string & | filename | ) |
| static

Obtain a NewGRF file by its filename.

Parameters

  filename | The filename to obtain the file for.

Returns
  The file.

Definition at line 416 of file newgrf.cpp.

References _grf_files.

Referenced by InitNewGRFFile().

## ◆ GetFileByGRFID()

static GRFFile* GetFileByGRFID | ( | uint32_t | grfid | ) |
| static

Obtain a NewGRF file by its grfID.

Parameters

  grfid | The grfID to obtain the file for

Returns
  The file.

Definition at line 403 of file newgrf.cpp.

References _grf_files.

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

## ◆ GetGlobalVariable()

bool GetGlobalVariable | ( | byte | param,
|  | uint32_t * | value,
|  | const GRFFile * | grffile
| ) |  |

Reads a variable common to VarAction2 and Action7/9/D.

Returns VarAction2 variable 'param' resp. Action7/9/D variable '0x80 + param'. If a variable is not accessible from all four actions, it is handled in the action specific functions.

Parameters

  param | variable number (as for VarAction2, for Action7/9/D you have to subtract 0x80 first).
  value | returns the value of the variable.
  grffile | NewGRF querying the variable

Returns
  true iff the variable is known and the value is returned in 'value'.

Definition at line 6546 of file newgrf.cpp.

References _settings_game, Clamp(), TimerGameCalendar::ConvertDateToYMD(), TimerGameCalendar::ConvertYMDToDate(), TimerGameTick::counter, TimerGameCalendar::date, TimerGameCalendar::date_fract, TimerGameConst< struct Calendar >::DAYS_TILL_ORIGINAL_BASE_YEAR, GameSettings::game_creation, GB(), TimerGame< struct Calendar >::IsLeapYear(), GameCreationSettings::landscape, TimerGameConst< struct Calendar >::ORIGINAL_BASE_YEAR, TimerGameConst< struct Calendar >::ORIGINAL_MAX_YEAR, VehicleSettings::road_side, GameSettings::vehicle, and TimerGameCalendar::year.

## ◆ GetNewEngine()

static Engine* GetNewEngine | ( | const GRFFile * | file,
|  | VehicleType | type,
|  | uint16_t | internal_id,
|  | bool | static_access = `false`
| ) |  |
| static

Returns the engine associated to a certain internal_id, resp.

allocates it.

Parameters

  file | NewGRF that wants to change the engine.
  type | Vehicle type.
  internal_id | Engine ID inside the NewGRF.
  static_access | If the engine is not present, return nullptr instead of allocating a new engine. (Used for static Action 0x04).

Returns
  The requested engine.

Definition at line 598 of file newgrf.cpp.

Referenced by AircraftVehicleChangeInfo(), RailVehicleChangeInfo(), RoadVehicleChangeInfo(), and ShipVehicleChangeInfo().

## ◆ GetNewEngineID()

EngineID GetNewEngineID | ( | const GRFFile * | file,
|  | VehicleType | type,
|  | uint16_t | internal_id
| ) |  |

Return the ID of a new engine.

Parameters

  file | The NewGRF file providing the engine.
  type | The Vehicle type.
  internal_id | NewGRF-internal ID of the engine.

Returns
  The new EngineID.

Note
  depending on the dynamic_engine setting and a possible override property the grfID may be unique or overwriting or partially re-defining properties of an existing engine.

Definition at line 690 of file newgrf.cpp.

## ◆ GlobalVarChangeInfo()

static ChangeInfoResult GlobalVarChangeInfo | ( | uint | gvid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for global variables.

Parameters

  gvid | ID of the global variable.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 2681 of file newgrf.cpp.

References LoadTranslationTable().

## ◆ GrfMsgI()

void GrfMsgI | ( | int | severity,
|  | const std::string & | msg
| ) |  |

Debug() function dedicated to newGRF debugging messages Function is essentially the same as Debug(grf, severity, ...) with the addition of file:line information when parsing grf files.

NOTE: for the above reason(s) GrfMsg() should ONLY be used for loading/parsing grf files, not for runtime debug messages as there is no file information available during that time.

Parameters

  severity | debugging severity level, see debug.h
  msg | the message

Definition at line 393 of file newgrf.cpp.

References Debug.

## ◆ GRFUnsafe()

static void GRFUnsafe | ( | ByteReader * |  | ) |
| static

Set the current NewGRF as unsafe for static use.

Note
  Used during safety scan on unsafe actions.

Definition at line 8592 of file newgrf.cpp.

References SetBit().

## ◆ HandleNode()

static bool HandleNode | ( | byte | type,
|  | uint32_t | id,
|  | ByteReader * | buf,
|  | AllowedSubtags | subtags[]
| ) |  |
| static

Handle the nodes of an Action14.

Parameters

  type | Type of node.
  id | ID.
  buf | Buffer.
  subtags | Allowed subtags.

Returns
  Whether all tags could be handled.

Definition at line 8529 of file newgrf.cpp.

References BSWAP32(), AllowedSubtags::id, and AllowedSubtags::type.

Referenced by HandleNodes().

## ◆ HandleNodes()

static bool HandleNodes | ( | ByteReader * | buf,
|  | AllowedSubtags | subtags[]
| ) |  |
| static

Handle the contents of a 'C' choice of an Action14.

Parameters

  buf | Buffer.
  subtags | List of subtags.

Returns
  Whether the nodes could all be handled.

Definition at line 8567 of file newgrf.cpp.

References HandleNode().

Referenced by StaticGRFInfo().

## ◆ HandleParameterInfo()

static bool HandleParameterInfo | ( | ByteReader * | buf | ) |
| static

Callback function for 'INFO'->'PARA' to set extra information about the parameters.

Each subnode of 'INFO'->'PARA' should be a branch node with the parameter number as id. The first parameter has id 0. The maximum parameter that can be changed is set by 'INFO'->'NPAR' which defaults to 80.

Definition at line 8436 of file newgrf.cpp.

## ◆ IgnoreIndustryProperty()

static ChangeInfoResult IgnoreIndustryProperty | ( | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Ignore an industry property.

Parameters

  prop | The property to ignore.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3364 of file newgrf.cpp.

References CIR_SUCCESS.

## ◆ IgnoreIndustryTileProperty()

static ChangeInfoResult IgnoreIndustryTileProperty | ( | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Ignore an industry tile property.

Parameters

  prop | The property to ignore.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3191 of file newgrf.cpp.

References CIR_SUCCESS, and CIR_UNKNOWN.

## ◆ IgnoreObjectProperty()

static ChangeInfoResult IgnoreObjectProperty | ( | uint | prop,
|  | ByteReader * | buf
| ) |  |
| static

Ignore properties for objects.

Parameters

  prop | The property to ignore.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 4067 of file newgrf.cpp.

References CIR_SUCCESS, and CIR_UNKNOWN.

## ◆ IgnoreRoadStopProperty()

static ChangeInfoResult IgnoreRoadStopProperty | ( | uint | prop,
|  | ByteReader * | buf
| ) |  |
| static

Ignore properties for roadstops.

Parameters

  prop | The property to ignore.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 4773 of file newgrf.cpp.

References CIR_SUCCESS, and CIR_UNKNOWN.

## ◆ IgnoreTownHouseProperty()

static ChangeInfoResult IgnoreTownHouseProperty | ( | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Ignore a house property.

Parameters

  prop | Property to read.
  buf | Property value.

Returns
  ChangeInfoResult.

Definition at line 2306 of file newgrf.cpp.

References CIR_SUCCESS, and CIR_UNKNOWN.

## ◆ ImportGRFSound()

static void ImportGRFSound | ( | SoundEntry * | sound | ) |
| static

Process a sound import from another GRF file.

Parameters

  sound | Destination for sound.

Definition at line 7834 of file newgrf.cpp.

## ◆ IndustriesChangeInfo()

static ChangeInfoResult IndustriesChangeInfo | ( | uint | indid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for industries.

Parameters

  indid | Local ID of the industry.
  numinfo | Number of subsequent industry IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3487 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_INDUSTRYTYPES_PER_GRF.

## ◆ IndustrytilesChangeInfo()

static ChangeInfoResult IndustrytilesChangeInfo | ( | uint | indtid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for industry tiles.

Parameters

  indtid | Local ID of the industry tile.
  numinfo | Number of subsequent industry tile IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3231 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_INDUSTRYTILES_PER_GRF.

## ◆ InitNewGRFFile()

static void InitNewGRFFile | ( | const GRFConfig * | config | ) |
| static

Prepare loading a NewGRF file with its config.

Parameters

  config | The NewGRF configuration struct with name, id, parameters and alike.

Definition at line 8908 of file newgrf.cpp.

References GRFConfig::filename, and GetFileByFilename().

## ◆ IsHouseSpecValid()

static bool IsHouseSpecValid | ( | HouseSpec * | hs,
|  | const HouseSpec * | next1,
|  | const HouseSpec * | next2,
|  | const HouseSpec * | next3,
|  | const std::string & | filename
| ) |  |
| static

Check if a given housespec is valid and disable it if it's not.

The housespecs that follow it are used to check the validity of multitile houses.

Parameters

  hs | The housespec to check.
  next1 | The housespec that follows `hs`.
  next2 | The housespec that follows `next1`.
  next3 | The housespec that follows `next2`.
  filename | The filename of the newgrf this house was defined in.

Returns
  Whether the given housespec is valid.

Definition at line 9278 of file newgrf.cpp.

References HouseSpec::building_flags.

Referenced by FinaliseHouseArray().

## ◆ IsValidNewGRFImageIndex()

template<VehicleType T>

static bool IsValidNewGRFImageIndex | ( | uint8_t | image_index | ) |
| inlinestatic

Helper to check whether an image index is valid for a particular NewGRF vehicle.

Template Parameters

  T | The type of vehicle.

Parameters

  image_index | The image index to check.

Returns
  True iff the image index is valid, or 0xFD (use new graphics).

Definition at line 206 of file newgrf.cpp.

## ◆ LoadGRFSound()

static void LoadGRFSound | ( | size_t | offs,
|  | SoundEntry * | sound
| ) |  |
| static

Load a sound from a file.

Parameters

  offs | File offset to read sound from.
  sound | Destination for sound.

Definition at line 7865 of file newgrf.cpp.

## ◆ LoadNewGRF()

void LoadNewGRF | ( | uint | load_index,
|  | uint | num_baseset
| ) |  |

Load all the NewGRFs.

Parameters

  load_index | The offset for the first sprite to add.
  num_baseset | Number of NewGRFs at the front of the list to look up in the baseset dir instead of the newgrf dir.

Definition at line 10039 of file newgrf.cpp.

References _display_opt, _grfconfig, _networking, _settings_game, TimerGameCalendar::ConvertYMDToDate(), TimerGameEconomy::ConvertYMDToDate(), TimerGameTick::counter, TimerGameCalendar::date, TimerGameEconomy::date, TimerGameCalendar::date_fract, TimerGameEconomy::date_fract, GameSettings::game_creation, GCS_NOT_FOUND, GCS_UNKNOWN, InitializeGRFSpecial(), GRFConfig::next, ResetNewGRFData(), GameCreationSettings::starting_year, GRFConfig::status, TimerGameCalendar::year, and TimerGameEconomy::year.

## ◆ LoadNewGRFFile()

void LoadNewGRFFile | ( | GRFConfig * | config,
|  | GrfLoadingStage | stage,
|  | Subdirectory | subdir,
|  | bool | temporary
| ) |  |

Load a particular NewGRF.

Parameters

  config | The configuration of the to be loaded NewGRF.
  stage | The loading stage of the NewGRF.
  subdir | The sub directory to find the NewGRF in.
  temporary | The NewGRF/sprite file is to be loaded temporarily and should be closed immediately, contrary to loading the SpriteFile and having it cached by the SpriteCache.

Definition at line 9717 of file newgrf.cpp.

References GRFConfig::filename.

Referenced by FillGRFDetails().

## ◆ LoadNewGRFFileFromFile()

static void LoadNewGRFFileFromFile | ( | GRFConfig * | config,
|  | GrfLoadingStage | stage,
|  | SpriteFile & | file
| ) |  |
| static

Load a particular NewGRF from a SpriteFile.

Parameters

  config | The configuration of the to be loaded NewGRF.
  stage | The loading stage of the NewGRF.
  file | The file to load the GRF data from.

Definition at line 9628 of file newgrf.cpp.

## ◆ LoadTranslationTable()

template<typename T >

static ChangeInfoResult LoadTranslationTable | ( | uint | gvid,
|  | int | numinfo,
|  | ByteReader * | buf,
|  | std::vector< T > & | translation_table,
|  | const char * | name
| ) |  |
| static

Load a cargo- or railtype-translation table.

Parameters

  | gvid | ID of the global variable. This is basically only checked for zerones.
  | numinfo | Number of subsequent IDs to change the property for.
  | buf | The property value.
  [in,out] | translation_table | Storage location for the translation table.
  | name | Name of the table for debug output.

Returns
  ChangeInfoResult.

Definition at line 2645 of file newgrf.cpp.

Referenced by GlobalVarChangeInfo().

## ◆ MapGRFStringID()

StringID MapGRFStringID | ( | uint32_t | grfid,
|  | StringID | str
| ) |  |

Used when setting an object's property to map to the GRF's strings while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one.

Parameters

  grfid | Id of the grf file.
  str | StringID that we want to have the equivalent in OoenTTD.

Returns
  The properly adjusted StringID.

Definition at line 550 of file newgrf.cpp.

References GetGRFStringID(), IsInsideMM(), and TTDPStringIDToOTTDStringIDMapping().

## ◆ MapSpriteMappingRecolour()

static void MapSpriteMappingRecolour | ( | PalSpriteID * | grf_sprite | ) |
| static

Map the colour modifiers of TTDPatch to those that Open is using.

Parameters

  grf_sprite | Pointer to the structure been modified.

Definition at line 706 of file newgrf.cpp.

References ClrBit(), HasBit(), PalSpriteID::pal, PALETTE_MODIFIER_COLOUR, PALETTE_MODIFIER_TRANSPARENT, SetBit(), PalSpriteID::sprite, and SPRITE_MODIFIER_OPAQUE.

## ◆ ObjectChangeInfo()

static ChangeInfoResult ObjectChangeInfo | ( | uint | id,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for objects.

Parameters

  id | Local ID of the object.
  numinfo | Number of subsequent objectIDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 4114 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_OBJECTS_PER_GRF.

## ◆ RailTypeChangeInfo()

static ChangeInfoResult RailTypeChangeInfo | ( | uint | id,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for railtypes.

Parameters

  id | ID of the railtype.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 4246 of file newgrf.cpp.

References CIR_SUCCESS.

## ◆ RailVehicleChangeInfo()

static ChangeInfoResult RailVehicleChangeInfo | ( | uint | engine,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for rail vehicles.

Parameters

  engine | :ocal ID of the first vehicle.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 1038 of file newgrf.cpp.

References CIR_SUCCESS, and GetNewEngine().

## ◆ ReadDWordAsString()

static std::string ReadDWordAsString | ( | ByteReader * | reader | ) |
| static

Helper to read a DWord worth of bytes from the reader and to return it as a valid string.

Parameters

  reader | The source of the DWord.

Returns
  The read DWord as string.

Definition at line 2666 of file newgrf.cpp.

References StrMakeValid().

## ◆ ReadSpriteLayout()

static bool ReadSpriteLayout | ( | ByteReader * | buf,
|  | uint | num_building_sprites,
|  | bool | use_cur_spritesets,
|  | byte | feature,
|  | bool | allow_var10,
|  | bool | no_z_position,
|  | NewGRFSpriteLayout * | dts
| ) |  |
| static

Read a spritelayout from the GRF.

Parameters

  buf | Input
  num_building_sprites | Number of building sprites to read
  use_cur_spritesets | Whether to use currently referenceable action 1 sets.
  feature | GrfSpecFeature to use spritesets from.
  allow_var10 | Whether the spritelayout may specify var10 values for resolving multiple action-1-2-3 chains
  no_z_position | Whether bounding boxes have no Z offset
  dts | Layout container to output into

Returns
  True on error (GRF was disabled).

Definition at line 848 of file newgrf.cpp.

References NewGRFSpriteLayout::Allocate(), ClrBit(), DrawTileSprites::ground, HasBit(), ReadSpriteLayoutSprite(), TLF_KNOWN_FLAGS, and TLF_VAR10_FLAGS.

## ◆ ReadSpriteLayoutRegisters()

static void ReadSpriteLayoutRegisters | ( | ByteReader * | buf,
|  | TileLayoutFlags | flags,
|  | bool | is_parent,
|  | NewGRFSpriteLayout * | dts,
|  | uint | index
| ) |  |
| static

Preprocess the TileLayoutFlags and read register modifiers from the GRF.

Parameters

  buf | Input stream.
  flags | TileLayoutFlags to process.
  is_parent | Whether the sprite is a parentsprite with a bounding box.
  dts | Sprite layout to insert data into.
  index | Sprite index to process; 0 for ground sprite.

Definition at line 795 of file newgrf.cpp.

References NewGRFSpriteLayout::AllocateRegisters(), TileLayoutRegisters::child, TileLayoutRegisters::dodraw, TileLayoutRegisters::flags, TileLayoutRegisters::palette, TileLayoutRegisters::parent, TileLayoutRegisters::sprite, TileLayoutRegisters::sprite_var10, TLF_BB_XY_OFFSET, TLF_BB_Z_OFFSET, TLF_CHILD_X_OFFSET, TLF_CHILD_Y_OFFSET, TLF_DODRAW, TLF_DRAWING_FLAGS, TLF_PALETTE, TLF_SPRITE, TLF_SPRITE_VAR10, and TLR_MAX_VAR10.

## ◆ ReadSpriteLayoutSprite()

static TileLayoutFlags ReadSpriteLayoutSprite | ( | ByteReader * | buf,
|  | bool | read_flags,
|  | bool | invert_action1_flag,
|  | bool | use_cur_spritesets,
|  | int | feature,
|  | PalSpriteID * | grf_sprite,
|  | uint16_t * | max_sprite_offset = `nullptr`,
|  | uint16_t * | max_palette_offset = `nullptr`
| ) |  |
| static

Read a sprite and a palette from the GRF and convert them into a format suitable to OpenTTD.

Parameters

  | buf | Input stream.
  | read_flags | Whether to read TileLayoutFlags.
  | invert_action1_flag | Set to true, if palette bit 15 means 'not from action 1'.
  | use_cur_spritesets | Whether to use currently referenceable action 1 sets.
  | feature | GrfSpecFeature to use spritesets from.
  [out] | grf_sprite | Read sprite and palette.
  [out] | max_sprite_offset | Optionally returns the number of sprites in the spriteset of the sprite. (0 if no spritset)
  [out] | max_palette_offset | Optionally returns the number of sprites in the spriteset of the palette. (0 if no spritset)

Returns
  Read TileLayoutFlags.

Definition at line 737 of file newgrf.cpp.

Referenced by ReadSpriteLayout().

## ◆ RoadTypeChangeInfo()

static ChangeInfoResult RoadTypeChangeInfo | ( | uint | id,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf,
|  | RoadTramType | rtt
| ) |  |
| static

Define properties for roadtypes.

Parameters

  id | ID of the roadtype.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 4464 of file newgrf.cpp.

References CIR_SUCCESS.

## ◆ RoadVehicleChangeInfo()

static ChangeInfoResult RoadVehicleChangeInfo | ( | uint | engine,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for road vehicles.

Parameters

  engine | Local ID of the first vehicle.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 1347 of file newgrf.cpp.

References CIR_SUCCESS, and GetNewEngine().

## ◆ SanitizeSpriteOffset()

static uint16_t SanitizeSpriteOffset | ( | uint16_t & | num,
|  | uint16_t | offset,
|  | int | max_sprites,
|  | const char * | name
| ) |  |
| static

Sanitize incoming sprite offsets for Action 5 graphics replacements.

Parameters

  num | The number of sprites to load.
  offset | Offset from the base.
  max_sprites | The maximum number of sprites that can be loaded in this action 5.
  name | Used for error warnings.

Returns
  The number of sprites that is going to be skipped.

Definition at line 6368 of file newgrf.cpp.

## ◆ SetNewGRFOverride()

static void SetNewGRFOverride | ( | uint32_t | source_grfid,
|  | uint32_t | target_grfid
| ) |  |
| static

Set the override for a NewGRF.

Parameters

  source_grfid | The grfID which wants to override another NewGRF.
  target_grfid | The grfID which is being overridden.

Definition at line 584 of file newgrf.cpp.

## ◆ ShipVehicleChangeInfo()

static ChangeInfoResult ShipVehicleChangeInfo | ( | uint | engine,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for ships.

Parameters

  engine | Local ID of the first vehicle.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 1553 of file newgrf.cpp.

References CIR_SUCCESS, and GetNewEngine().

## ◆ SkipUnknownInfo()

static bool SkipUnknownInfo | ( | ByteReader * | buf,
|  | byte | type
| ) |  |
| static

Try to skip the current node and all subnodes (if it's a branch node).

Parameters

  buf | Buffer.
  type | The node type to skip.

Returns
  True if we could skip the node, false if an error occurred.

Definition at line 8489 of file newgrf.cpp.

## ◆ SoundEffectChangeInfo()

static ChangeInfoResult SoundEffectChangeInfo | ( | uint | sid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for sound effects.

Parameters

  sid | Local ID of the sound.
  numinfo | Number of subsequent IDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 3136 of file newgrf.cpp.

References CIR_SUCCESS.

## ◆ StaticGRFInfo()

static void StaticGRFInfo | ( | ByteReader * | buf | ) |
| static

Handle Action 0x14.

Parameters

  buf | Buffer.

Definition at line 8582 of file newgrf.cpp.

References _tags_root, and HandleNodes().

## ◆ StationChangeInfo()

static ChangeInfoResult StationChangeInfo | ( | uint | stid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for stations.

Parameters

  stid | StationID of the first station tile.
  numinfo | Number of subsequent station tiles to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 1910 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_STATIONS_PER_GRF.

## ◆ TownHouseChangeInfo()

static ChangeInfoResult TownHouseChangeInfo | ( | uint | hid,
|  | int | numinfo,
|  | int | prop,
|  | ByteReader * | buf
| ) |  |
| static

Define properties for houses.

Parameters

  hid | HouseID of the house.
  numinfo | Number of subsequent houseIDs to change the property for.
  prop | The property to change.
  buf | The property value.

Returns
  ChangeInfoResult.

Definition at line 2373 of file newgrf.cpp.

References CIR_SUCCESS, and NUM_HOUSES_PER_GRF.

## ◆ TranslateRefitMask()

static CargoTypes TranslateRefitMask | ( | uint32_t | refit_mask | ) |
| static

Translate the refit mask.

refit_mask is uint32_t as it has not been mapped to CargoTypes.

Definition at line 941 of file newgrf.cpp.

## ◆ TTDPStringIDToOTTDStringIDMapping()

static StringID TTDPStringIDToOTTDStringIDMapping | ( | StringID | str | ) |
| static

Perform a mapping from TTDPatch's string IDs to OpenTTD's string IDs, but only for the ones we are aware off; the rest like likely unused and will show a warning.

Parameters

  str | the string ID to convert

Returns
  the converted string ID

Definition at line 486 of file newgrf.cpp.

References IsInsideMM().

Referenced by MapGRFStringID().

## ◆ ValidateIndustryLayout()

static bool ValidateIndustryLayout | ( | const IndustryTileLayout & | layout | ) |
| static

Validate the industry layout; e.g.

to prevent duplicate tiles.

Parameters

  layout | The layout to check.

Returns
  True if the layout is deemed valid.

Definition at line 3454 of file newgrf.cpp.

References GFX_WATERTILE_SPECIALCHECK.

## Variable Documentation

## ◆ _action5_types

const Action5Type _action5_types[]
| static

Initial value:
= {
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x00" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x01" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x02" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x03" },
{ A5BLOCK_ALLOW_OFFSET, SPR_SIGNALS_BASE, 1, PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT, "Signal graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ELRAIL_BASE, 1, ELRAIL_SPRITE_COUNT, "Rail catenary graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_SLOPES_BASE, 1, NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT, "Foundation graphics" },
{ A5BLOCK_INVALID, 0, 75, 0, "TTDP GUI graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_CANALS_BASE, 1, CANALS_SPRITE_COUNT, "Canal graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ONEWAY_BASE, 1, ONEWAY_SPRITE_COUNT, "One way road graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_2CCMAP_BASE, 1, TWOCCMAP_SPRITE_COUNT, "2CC colour maps" },
{ A5BLOCK_ALLOW_OFFSET, SPR_TRAMWAY_BASE, 1, TRAMWAY_SPRITE_COUNT, "Tramway graphics" },
{ A5BLOCK_INVALID, 0, 133, 0, "Snowy temperate tree" },
{ A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SPR_SHORE_SPRITE_COUNT, "Shore graphics" },
{ A5BLOCK_INVALID, 0, 0, 0, "New Signals graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_TRACKS_FOR_SLOPES_BASE, 1, TRACKS_FOR_SLOPES_SPRITE_COUNT, "Sloped rail track" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AIRPORTX_BASE, 1, AIRPORTX_SPRITE_COUNT, "Airport graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ROADSTOP_BASE, 1, ROADSTOP_SPRITE_COUNT, "Road stop graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AQUEDUCT_BASE, 1, AQUEDUCT_SPRITE_COUNT, "Aqueduct graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AUTORAIL_BASE, 1, AUTORAIL_SPRITE_COUNT, "Autorail graphics" },
{ A5BLOCK_INVALID, 0, 1, 0, "Flag graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_OPENTTD_BASE, 1, OPENTTD_SPRITE_COUNT, "OpenTTD GUI graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AIRPORT_PREVIEW_BASE, 1, SPR_AIRPORT_PREVIEW_COUNT, "Airport preview graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_RAILTYPE_TUNNEL_BASE, 1, RAILTYPE_TUNNEL_BASE_COUNT, "Railtype tunnel base" },
{ A5BLOCK_ALLOW_OFFSET, SPR_PALETTE_BASE, 1, PALETTE_SPRITE_COUNT, "Palette" },
}

The information about action 5 types.

Definition at line 6405 of file newgrf.cpp.

## ◆ _grm_engines

uint32_t _grm_engines[256]
| static

Contains the GRF ID of the owner of a vehicle if it has been reserved.

GRM for vehicles is only used if dynamic engine allocation is disabled, so 256 is the number of original engines.

Definition at line 357 of file newgrf.cpp.

## ◆ _tags_info

AllowedSubtags _tags_info[]

Initial value:
= {
AllowedSubtags('NAME', ChangeGRFName),
AllowedSubtags('DESC', ChangeGRFDescription),
AllowedSubtags('URL_', ChangeGRFURL),
AllowedSubtags('NPAR', ChangeGRFNumUsedParams),
AllowedSubtags('PALS', ChangeGRFPalette),
AllowedSubtags('BLTR', ChangeGRFBlitter),
AllowedSubtags('VRSN', ChangeGRFVersion),
AllowedSubtags('MINV', ChangeGRFMinVersion),
AllowedSubtags('PARA', HandleParameterInfo),
AllowedSubtags()
}

Action14 tags for the INFO node.

Definition at line 8463 of file newgrf.cpp.

## ◆ _tags_parameters

AllowedSubtags _tags_parameters[]

Initial value:
= {
AllowedSubtags('NAME', ChangeGRFParamName),
AllowedSubtags('DESC', ChangeGRFParamDescription),
AllowedSubtags('TYPE', ChangeGRFParamType),
AllowedSubtags('LIMI', ChangeGRFParamLimits),
AllowedSubtags('MASK', ChangeGRFParamMask),
AllowedSubtags('VALU', ChangeGRFParamValueNames),
AllowedSubtags('DFLT', ChangeGRFParamDefault),
AllowedSubtags()
}

Action14 parameter tags.

Definition at line 8419 of file newgrf.cpp.

## ◆ _tags_root

AllowedSubtags _tags_root[]

Initial value:
= {
AllowedSubtags('INFO', _tags_info),
AllowedSubtags()
}

Action14 root tags.

Definition at line 8477 of file newgrf.cpp.

Referenced by StaticGRFInfo().

## ◆ _ttdpatch_flags

uint32_t _ttdpatch_flags[8]
| static

32 * 8 = 256 flags.

Apparently TTDPatch uses this many..

Definition at line 79 of file newgrf.cpp.

Referenced by InitializeGRFSpecial().

ChangeGRFName
static bool ChangeGRFName(byte langid, const char *str)
Callback function for 'INFO'->'NAME' to add a translation to the newgrf name.
Definition: newgrf.cpp:8095
SPR_SHORE_BASE
static const SpriteID SPR_SHORE_BASE
shore tiles - action 05-0D
Definition: sprites.h:224
A5BLOCK_INVALID
@ A5BLOCK_INVALID
unknown/not-implemented type
Definition: newgrf.cpp:6393
ChangeGRFParamLimits
static bool ChangeGRFParamLimits(size_t len, ByteReader *buf)
Callback function for 'INFO'->'PARAM'->param_num->'LIMI' to set the min/max value of a parameter.
Definition: newgrf.cpp:8242
ChangeGRFVersion
static bool ChangeGRFVersion(size_t len, ByteReader *buf)
Callback function for 'INFO'->'VRSN' to the version of the NewGRF.
Definition: newgrf.cpp:8176
ChangeGRFParamName
static bool ChangeGRFParamName(byte langid, const char *str)
Callback function for 'INFO'->'PARAM'->param_num->'NAME' to set the name of a parameter.
Definition: newgrf.cpp:8211
_tags_info
AllowedSubtags _tags_info[]
Action14 tags for the INFO node.
Definition: newgrf.cpp:8463
ChangeGRFParamType
static bool ChangeGRFParamType(size_t len, ByteReader *buf)
Callback function for 'INFO'->'PARAM'->param_num->'TYPE' to set the typeof a parameter.
Definition: newgrf.cpp:8225
SPR_AQUEDUCT_BASE
static const SpriteID SPR_AQUEDUCT_BASE
Sprites for the Aqueduct.
Definition: sprites.h:186
HandleParameterInfo
static bool HandleParameterInfo(ByteReader *buf)
Callback function for 'INFO'->'PARA' to set extra information about the parameters.
Definition: newgrf.cpp:8436
ChangeGRFURL
static bool ChangeGRFURL(byte langid, const char *str)
Callback function for 'INFO'->'URL_' to set the newgrf url.
Definition: newgrf.cpp:8109
ChangeGRFParamMask
static bool ChangeGRFParamMask(size_t len, ByteReader *buf)
Callback function for 'INFO'->'PARAM'->param_num->'MASK' to set the parameter and bits to use.
Definition: newgrf.cpp:8264
ChangeGRFParamValueNames
static bool ChangeGRFParamValueNames(ByteReader *buf)
Callback function for 'INFO'->'PARA'->param_num->'VALU' to set the names of some parameter values (ty...
Definition: newgrf.cpp:8389
SPR_RAILTYPE_TUNNEL_BASE
static const SpriteID SPR_RAILTYPE_TUNNEL_BASE
Tunnel sprites with grass only for custom railtype tunnel.
Definition: sprites.h:299
A5BLOCK_FIXED
@ A5BLOCK_FIXED
Only allow replacing a whole block of sprites. (TTDP compatible)
Definition: newgrf.cpp:6391
A5BLOCK_ALLOW_OFFSET
@ A5BLOCK_ALLOW_OFFSET
Allow replacing any subset by specifiing an offset.
Definition: newgrf.cpp:6392
ChangeGRFBlitter
static bool ChangeGRFBlitter(size_t len, ByteReader *buf)
Callback function for 'INFO'->'BLTR' to set the blitter info.
Definition: newgrf.cpp:8154
ChangeGRFNumUsedParams
static bool ChangeGRFNumUsedParams(size_t len, ByteReader *buf)
Callback function for 'INFO'->'NPAR' to set the number of valid parameters.
Definition: newgrf.cpp:8116
ChangeGRFMinVersion
static bool ChangeGRFMinVersion(size_t len, ByteReader *buf)
Callback function for 'INFO'->'MINV' to the minimum compatible version of the NewGRF.
Definition: newgrf.cpp:8189
ChangeGRFDescription
static bool ChangeGRFDescription(byte langid, const char *str)
Callback function for 'INFO'->'DESC' to add a translation to the newgrf description.
Definition: newgrf.cpp:8102
AllowedSubtags
Data structure to store the allowed id/type combinations for action 14.
Definition: newgrf.cpp:8308
SPR_AIRPORT_PREVIEW_BASE
static const SpriteID SPR_AIRPORT_PREVIEW_BASE
Airport preview sprites.
Definition: sprites.h:248
SPR_OPENTTD_BASE
static const SpriteID SPR_OPENTTD_BASE
Extra graphic spritenumbers.
Definition: sprites.h:56
ChangeGRFParamDefault
static bool ChangeGRFParamDefault(size_t len, ByteReader *buf)
Callback function for 'INFO'->'PARAM'->param_num->'DFLT' to set the default value.
Definition: newgrf.cpp:8285
ChangeGRFPalette
static bool ChangeGRFPalette(size_t len, ByteReader *buf)
Callback function for 'INFO'->'PALS' to set the number of valid parameters.
Definition: newgrf.cpp:8128
SPR_TRACKS_FOR_SLOPES_BASE
static const SpriteID SPR_TRACKS_FOR_SLOPES_BASE
Sprites for 'highlighting' tracks on sloped land.
Definition: sprites.h:198
ChangeGRFParamDescription
static bool ChangeGRFParamDescription(byte langid, const char *str)
Callback function for 'INFO'->'PARAM'->param_num->'DESC' to set the description of a parameter.
Definition: newgrf.cpp:8218
SPR_ONEWAY_BASE
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
Definition: sprites.h:293
SPR_TRAMWAY_BASE
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
Definition: sprites.h:272