OpenTTD Source 20241224-master-gf74b0cf984
|
NewGRF handling of road types. More...
Go to the source code of this file.
Data Structures | |
struct | RoadTypeScopeResolver |
Resolver for the railtype scope. More... | |
struct | RoadTypeResolverObject |
Resolver object for road types. More... | |
Functions | |
SpriteID | GetCustomRoadSprite (const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context=TCX_NORMAL, uint *num_results=nullptr) |
Get the sprite to draw for the given tile. | |
RoadType | GetRoadTypeTranslation (RoadTramType rtt, uint8_t tracktype, const GRFFile *grffile) |
Translate an index to the GRF-local road/tramtype-translation table into a RoadType. | |
uint8_t | GetReverseRoadTypeTranslation (RoadType roadtype, const GRFFile *grffile) |
Perform a reverse roadtype lookup to get the GRF internal ID. | |
NewGRF handling of road types.
Definition in file newgrf_roadtype.h.
SpriteID GetCustomRoadSprite | ( | const RoadTypeInfo * | rti, |
TileIndex | tile, | ||
RoadTypeSpriteGroup | rtsg, | ||
TileContext | context, | ||
uint * | num_results | ||
) |
Get the sprite to draw for the given tile.
rti | The road type data (spec). | |
tile | The tile to get the sprite for. | |
rtsg | The type of sprite to draw. | |
content | Where are we drawing the tile? | |
[out] | num_results | If not nullptr, return the number of sprites in the spriteset. |
Definition at line 101 of file newgrf_roadtype.cpp.
References RoadTypeInfo::group, and SpriteGroup::Resolve().
Referenced by DrawBridgeRoadBits(), DrawRoadBits(), DrawRoadDepotSprite(), DrawRoadOverlays(), DrawRoadStopTile(), DrawRoadTypeCatenary(), DrawTile_Road(), DrawTile_TunnelBridge(), and GetBridgeRoadCatenary().
Perform a reverse roadtype lookup to get the GRF internal ID.
roadtype | The global (OpenTTD) roadtype. |
grffile | The GRF to do the lookup for. |
Definition at line 153 of file newgrf_roadtype.cpp.
References find_index(), GetRoadTypeInfo(), RoadTypeInfo::label, GRFFile::roadtype_list, and GRFFile::tramtype_list.
Referenced by RoadStopScopeResolver::GetVariable().
Translate an index to the GRF-local road/tramtype-translation table into a RoadType.
rtt | Whether to index the road- or tramtype-table. |
tracktype | Index into GRF-local translation table. |
grffile | Originating GRF file. |
Definition at line 123 of file newgrf_roadtype.cpp.
References GetRoadTypeByLabel(), INVALID_ROADTYPE, GRFFile::roadtype_list, and GRFFile::tramtype_list.