Rail types are only available in OpenTTD since r18969.
This feature allows to define and use up to 16 or 64 (OpenTTD since 1.9) rail types. Rail type IDs are newGRF local, with an ID to label mapping. Therefore to modify an existing rail type, specify its label in definerailtype(). To create a new rail type, again just specify its label in function definerailtype(). This way there is no need for complex GRM mechanisms to allocate IDs. If a label 'clashes' with another newGRF, then one newGRF will end up modifying the properties instead of creating a new rail type.
When a new rail type is created, it is populated with the information from the first rail type, except that the compatible and powered list contain only the rail type being created. However, no default values should be assumed, as the first rail type may have been modified.
Property function | Description |
acceleration(<Byte>) | Acceleration model |
alternate_list(<List::Label>) | Alternate rail type list |
autoreplacetext(<String>) | Text ID for autoreplace text |
compatible_list(<List::Label>) | Compatible rail type list |
costfactor(<Word>) | Construction cost factor |
curvespeed(<Byte>) | Curve speed advantage multiplier |
intro(<Date>) | Introduction date |
introduce_list(<List::Label>) | Introduce rail type list |
maintenancefactor(<Word>) | Infrastructure maintenance cost factor |
mapcolour(<Byte>) | Minimap colour |
menutext(<String>) | Text ID for 'rail construction' dropdown text |
newenginetext(<String>) | Text ID for 'new engine' text |
powered_list(<List::Label>) | Powered rail type list |
railtypeflags(<List>) | Rail type flags |
railtypename(<String>) | Text ID for rail type name |
required_list(<List::Label>) | Required rail type list |
speedlimit(<Unit-term>) | Speed limit |
stationtype(<Byte>) | Station (and depot) graphics |
toolbartext(<String>) | Text ID for 'build rail' toolbar caption |
vehwindowtext(<String>) | Text ID for 'build vehicle' window caption |
This property function defines the acceleration model used. Valid values are RAIL, MONO, MGLV. At the moment there is no difference between normal rail and monorail.
This function defines a list of alternate rail types that get 'redirected' to the current rail type when used e.g. as rail type of train or when testing if a label is defined. Format is the same as for compatible_list().
Alternate labels are not considered in functions compatible_list(), powered_list(), introduce_list(), and required_list().
Text ID for rail type shown in autoreplace window.
compatible_list(<List::Label>)
This function defines a list of rail types on which trains of this rail type can run, even though they might not be powered. E.g. wagons/engines of 'electrified rail' type are also compatible to 'normal rail' and 'third rail' type, but they are not powered (there need to be an other powered engine in the consist to move the train). A rail type is automatically compatible (and powered) with itself, so you don't need to list the current rail type.
Note that these properties apply to trains of this rail type, not the track. If you want trains of other rail types to be able to run on your rail types, you must set the compatible rail types property for each rail type. Setting these properties behaves always incremental, so you only need to set the additional bits for each other rail type, you cannot remove compatibility/poweredness once it is set (by some other grf).
This function sets the multiplier for the curve speed advantage, which all trains running on this track type will get. The base curve speed advantage is given by the multiplication of the value of this function with the base speed advantage, depending on the curve length in wagons:
Curve length | Base speed adv. |
0 (90° turn) | 30 |
1 (2x45° turn) | 44 |
2 | 55 |
3 | 66 |
4 | 75 |
5 | 84 |
6 | 91 |
7 | 98 |
8 | 103 |
9 | 108 |
10 | 111 |
11 | 114 |
12+ | 115 |
'Curve length' is the average number of wagons of the train between turns. However, very sharp turns (values 0 and 1) are not averaged out in longer trains. The maximum speed for a train in a curve is defined by 'base speed advantage' * (2 + curvespeed()). Tilting trains get an additional bonus of 20% to this value.
For the default rail types this property is 0 for normal rail and electrified rail, 1 for monorail, and 2 for maglev.
This function defines the introduction date of this rail type. The given rail type will be introduced at (or after) this date, when all of the introduction required rail types (see below) are available to the company of the player, or whenever a vehicle using this rail type gets introduced, whichever is first.
This function defines a list of rail types that get (automatically) introduced when the given rail type is introduced. For example, to make sure that when a fast rail type is introduced, a slow variant exists as well.
This property defines the colour this track type is drawn in the minimap view. The byte value specifies the colour entry in the DOS palette.
Text ID for text in the dropdown menu of all rail types. This string must never start with a colour control code.
Text ID to use for showing texts of the type 'We have invented a new <rail type> engine'.
This function defines a list of rail types on which trains of this rail type are powered. E.g. engines of 'normal rail' type are powered on 'electrified rail' and 'third-rail' type as well.
This function defines flags to define properties related to the rail type:
Label | Meaning |
RT_CATY | Draw catenary for this rail |
RT_XING | Disallow level crossings for this rail (since r20049) |
RT_HIDE | Hide this railtype from construction menu (since 1.9) |
RT_OVRL | Enable use of precombined overlay sprites (since 1.10) |
RT_ALLOW90 | Always allow 90° curves (since 1.10) |
RT_DISALLOW90 | Always disallow 90° curves (since 1.10) |
Text ID of the name of the rail type. For newGRF versions 7 or earlier, use this property function after property function toolbartext(), as this sets the rail type name as well for backwards compatibility.
This function defines a list of rail types that need to be available to the company of the player for this rail type to be introduced at (or after) the introduction date. This limit does not apply when the rail type is introduced by the introduction of a vehicle.
For example, to be used to introduce a third rail with catenary track type when both third rail and catenary rail types are available.
This function defines the default graphics for the stations. If no depot sprites are defined, this also defines at the same time the depot sprites to be used. There are three kind of default stations (and depots), usually associated with rail, monorail and maglev tracks. Valid values are RAIL, MONO, MGLV.
Text ID of the name of the rail type as shown in the toolbar caption. OpenTTD before r20342 and 1.0.3 require the string to start with the white control code. Later versions of OpenTTD will automatically default to white.
Text ID for build vehicle window caption. OpenTTD before r20342 and 1.0.3 require the string to start with the white control code. Later versions of OpenTTD will automatically default to white.