OpenTTD Source
20241125-master-g5b02f51e17
|
NewGRF handling of rail types. More...
Go to the source code of this file.
Data Structures | |
struct | RailTypeScopeResolver |
Resolver for the railtype scope. More... | |
struct | RailTypeResolverObject |
Resolver object for rail types. More... | |
Functions | |
SpriteID | GetCustomRailSprite (const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context=TCX_NORMAL, uint *num_results=nullptr) |
Get the sprite to draw for the given tile. More... | |
SpriteID | GetCustomSignalSprite (const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui=false) |
Get the sprite to draw for a given signal. More... | |
RailType | GetRailTypeTranslation (uint8_t railtype, const GRFFile *grffile) |
Translate an index to the GRF-local railtype-translation table into a RailType. More... | |
uint8_t | GetReverseRailTypeTranslation (RailType railtype, const GRFFile *grffile) |
Perform a reverse railtype lookup to get the GRF internal ID. More... | |
NewGRF handling of rail types.
Definition in file newgrf_railtype.h.
SpriteID GetCustomRailSprite | ( | const RailTypeInfo * | rti, |
TileIndex | tile, | ||
RailTypeSpriteGroup | rtsg, | ||
TileContext | context, | ||
uint * | num_results | ||
) |
Get the sprite to draw for the given tile.
rti | The rail type data (spec). | |
tile | The tile to get the sprite for. | |
rtsg | The type of sprite to draw. | |
context | Where are we drawing the tile? | |
[out] | num_results | If not nullptr, return the number of sprites in the spriteset. |
Definition at line 96 of file newgrf_railtype.cpp.
Referenced by DrawTile_TunnelBridge(), DrawTrackDetails(), GetPylonBase(), and GetWireBase().
SpriteID GetCustomSignalSprite | ( | const RailTypeInfo * | rti, |
TileIndex | tile, | ||
SignalType | type, | ||
SignalVariant | var, | ||
SignalState | state, | ||
bool | gui | ||
) |
Get the sprite to draw for a given signal.
rti | The rail type data (spec). |
tile | The tile to get the sprite for. |
type | Signal type. |
var | Signal variant. |
state | Signal state. |
gui | Is the sprite being used on the map or in the GUI? |
Definition at line 121 of file newgrf_railtype.cpp.
References RailTypeInfo::group, SpriteGroup::Resolve(), RTSG_SIGNALS, and TCX_NORMAL.
Translate an index to the GRF-local railtype-translation table into a RailType.
railtype | Index into GRF-local translation table. |
grffile | Originating GRF file. |
Definition at line 141 of file newgrf_railtype.cpp.
References GetRailTypeByLabel(), GetRailTypeInfo(), INVALID_RAILTYPE, RAILTYPE_END, and GRFFile::railtype_list.
Perform a reverse railtype lookup to get the GRF internal ID.
railtype | The global (OpenTTD) railtype. |
grffile | The GRF to do the lookup for. |
Definition at line 163 of file newgrf_railtype.cpp.
References find_index(), GetRailTypeInfo(), RailTypeInfo::label, and GRFFile::railtype_list.