OpenTTD
newgrf_roadtype.h File Reference

NewGRF handling of road types. More...

#include "road.h"
#include "newgrf_commons.h"
#include "newgrf_spritegroup.h"

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. More...
 
uint8 GetReverseRoadTypeTranslation (RoadType roadtype, const GRFFile *grffile)
 Perform a reverse roadtype lookup to get the GRF internal ID. More...
 

Detailed Description

NewGRF handling of road types.

Definition in file newgrf_roadtype.h.

Function Documentation

◆ GetCustomRoadSprite()

SpriteID GetCustomRoadSprite ( const RoadTypeInfo rti,
TileIndex  tile,
RoadTypeSpriteGroup  rtsg,
TileContext  context,
uint *  num_results 
)

Get the sprite to draw for the given tile.

Parameters
rtiThe road type data (spec).
tileThe tile to get the sprite for.
rtsgThe type of sprite to draw.
contentWhere are we drawing the tile?
[out]num_resultsIf not nullptr, return the number of sprites in the spriteset.
Returns
The sprite to draw.

Definition at line 104 of file newgrf_roadtype.cpp.

Referenced by DrawRoadOverlays(), and RoadTypeResolverObject::GetScope().

◆ GetReverseRoadTypeTranslation()

uint8 GetReverseRoadTypeTranslation ( RoadType  roadtype,
const GRFFile grffile 
)

Perform a reverse roadtype lookup to get the GRF internal ID.

Parameters
roadtypeThe global (OpenTTD) roadtype.
grffileThe GRF to do the lookup for.
Returns
the GRF internal ID.

Definition at line 125 of file newgrf_roadtype.cpp.

Referenced by RoadTypeResolverObject::GetScope().