Functions

# newgrf_railtype.cpp File Reference

NewGRF handling of rail types. More...

`#include "stdafx.h"`
`#include "debug.h"`
`#include "newgrf_spritegroup.h"`
`#include "date_func.h"`
`#include "depot_base.h"`
`#include "town.h"`

Go to the source code of this file.

## Functions
static uint32 | RailTypeGetRandomBits (const ResolverObject *object)
static uint32 | RailTypeGetTriggers (const ResolverObject *object)
static void | RailTypeSetTriggers (const ResolverObject *object, int triggers)
static uint32 | RailTypeGetVariable (const ResolverObject *object, byte variable, uint32 parameter, bool *available)
static const SpriteGroup * | RailTypeResolveReal (const ResolverObject *object, const RealSpriteGroup *group)
static void | NewRailTypeResolver (ResolverObject *res, TileIndex tile, TileContext context, const GRFFile *grffile)
SpriteID | GetCustomRailSprite (const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context)
| Get the sprite to draw for the given tile.
uint8 | GetReverseRailTypeTranslation (RailType railtype, const GRFFile *grffile)
| Perform a reverse railtype lookup to get the GRF internal ID.
void | GetRailTypeResolver (ResolverObject *ro, uint index)
| Resolve a railtypes's spec and such so we can get a variable.

## Detailed Description

NewGRF handling of rail types.

Definition in file newgrf_railtype.cpp.

## Function Documentation

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

Get the sprite to draw for the given tile.

Parameters:

  | rti | The rail 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?

Returns:
  The sprite to draw.

Definition at line 107 of file newgrf_railtype.cpp.

References RailtypeInfo::grffile, RailtypeInfo::group, and SpriteGroup::Resolve().

Referenced by DrawBridgeMiddle(), DrawTile_Road(), DrawTile_TunnelBridge(), GetPylonBase(), and GetWireBase().

void GetRailTypeResolver | ( | ResolverObject * | ro,
|  | uint | index |
| ) |  |  |

Resolve a railtypes's spec and such so we can get a variable.

Parameters:

  | ro | The resolver object to fill.
  | index | The rail tile to get the data from.

Definition at line 150 of file newgrf_railtype.cpp.

References TCX_NORMAL.

uint8 GetReverseRailTypeTranslation | ( | RailType | railtype,
|  | const GRFFile * | grffile |
| ) |  |  |

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

Parameters:

  | railtype | The global (OpenTTD) railtype.
  | grffile | The GRF to do the lookup for.

Returns:
  the GRF internal ID.

Definition at line 130 of file newgrf_railtype.cpp.

References GetRailTypeInfo(), and RailtypeInfo::label.