OpenTTD
Functions
newgrf_railtype.cpp File Reference

NewGRF handling of rail types. More...

#include "stdafx.h"
#include "debug.h"
#include "newgrf_railtype.h"
#include "date_func.h"
#include "depot_base.h"
#include "town.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

SpriteID GetCustomRailSprite (const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
 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)
 Get the sprite to draw for a given signal. More...
 
uint8 GetReverseRailTypeTranslation (RailType railtype, const GRFFile *grffile)
 Perform a reverse railtype lookup to get the GRF internal ID. More...
 

Detailed Description

NewGRF handling of rail types.

Definition in file newgrf_railtype.cpp.

Function Documentation

◆ GetCustomRailSprite()

SpriteID GetCustomRailSprite ( const RailtypeInfo rti,
TileIndex  tile,
RailTypeSpriteGroup  rtsg,
TileContext  context,
uint *  num_results 
)

Get the sprite to draw for the given tile.

Parameters
rtiThe rail 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 NULL, return the number of sprites in the spriteset.
Returns
The sprite to draw.

Definition at line 94 of file newgrf_railtype.cpp.

Referenced by DrawTile_TunnelBridge(), DrawTrackDetails(), GetPylonBase(), RailTypeResolverObject::GetScope(), and GetWireBase().

◆ GetCustomSignalSprite()

SpriteID GetCustomSignalSprite ( const RailtypeInfo rti,
TileIndex  tile,
SignalType  type,
SignalVariant  var,
SignalState  state,
bool  gui 
)

Get the sprite to draw for a given signal.

Parameters
rtiThe rail type data (spec).
tileThe tile to get the sprite for.
typeSignal type.
varSignal variant.
stateSignal state.
guiIs the sprite being used on the map or in the GUI?
Returns
The sprite to draw.

Definition at line 119 of file newgrf_railtype.cpp.

References RailtypeInfo::group, SpriteGroup::Resolve(), RTSG_SIGNALS, and TCX_NORMAL.

Referenced by RailTypeResolverObject::GetScope().

◆ GetReverseRailTypeTranslation()

uint8 GetReverseRailTypeTranslation ( RailType  railtype,
const GRFFile grffile 
)

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

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

Definition at line 139 of file newgrf_railtype.cpp.

References SmallVector< T, S >::FindIndex(), GetRailTypeInfo(), RailtypeInfo::label, SmallVector< T, S >::Length(), and GRFFile::railtype_list.

Referenced by RailTypeResolverObject::GetScope().