The m4nfo User manual and Technical Report

Properties for road and tram types

Defining properties of road/tram types

Introduction

Road/tram types are only available in OpenTTD since rXXXXX.

This feature allows to define and use up to 63 (OpenTTD since 1.9) road/tram types. Road/tram type IDs are newGRF local, with an ID to label mapping. Therefore to modify an existing road/tram type, specify its label in defineroadtype/definetramtype(). To create a new road/tram type, again just specify its label in function defineroadtype/definetramtype(). 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 road/tram type.

When a new road/tram type is created, it is populated with the information from the first road/tram type, except that the powered list contains only the road/tram type being created. However, no default values should be assumed, as the first road/tram type may have been modified.

Functions alternate_list(), powered_list(), introduce_list(), and required_list() take road/tram type labels as their arguments. Please note that these labels have to be given as quoted strings, i.e. like this: {"HWAY"}.

Properties

Property function Description
alternate_list(<List::Label>)Alternate road/tram type list
autoreplacetext(<String>)Text ID for autoreplace text
costfactor(<Word>)Construction cost factor
intro(<Date>)Introduction date
introduce_list(<List::Label>)Introduce road/tram type list
maintenancefactor(<Word>)Infrastructure maintenance cost factor
mapcolour(<Byte>)Minimap colour
menutext(<String>)Text ID for 'road/tram construction' dropdown text
newenginetext(<String>)Text ID for 'new engine' text
powered_list(<List::Label>)Powered road/tram type list
roadtypeflags/tramtypeflags(<List>)Road/tram type flags
roadtypename/tramtypename(<String>)Text ID for road/tram type name
required_list(<List::Label>)Required road/tram type list
sortorder(<Byte>)Sort order
speedlimit(<Unit-term>)Speed limit
toolbartext(<String>)Text ID for 'build road/tram' toolbar caption
vehwindowtext(<String>)Text ID for 'build vehicle' window caption

Description

alternate_list(<List::Label>)

This function defines a list of alternate road/tram types that get 'redirected' to the current road/tram type when used e.g. as road/tram type of this vehicle or when testing if a label is defined.

Alternate labels are not considered in functions powered_list(), introduce_list(), and required_list().

autoreplacetext(<String>)

Text ID for road/tram type shown in autoreplace window.

intro(<Date>)

This function defines the introduction date of this road/tram type. The given road/tram type will be introduced at (or after) this date, when all of the introduction required road/tram types (see below) are available to the company of the player, or whenever a vehicle using this road/tram type gets introduced, whichever is first.

introduce_list(<List::Label>)

This function defines a list of road/tram types that get (automatically) introduced when the given road/tram type is introduced. For example, to make sure that when a fast road/tram type is introduced, a slow variant exists as well.

mapcolour(<Byte>)

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.

menutext(<String>)

Text ID for text in the dropdown menu of all road/tram types. This string must never start with a colour control code.

newenginetext(<String>)

Text ID to use for showing texts of the type 'We have invented a new <road/tram type> engine'.

powered_list(<List::Label>)

This function defines a list of road/tram types on which trains of this road/tram type are powered. E.g. engines of 'normal road/tram' type are powered on 'electrified road/tram' and 'third-road/tram' type as well.

roadtypeflags/tramtypefleags(<List>)

This function defines flags to define properties related to the road/tram type:

LabelMeaning
RT_CATYDraw catenary for this road/tram type
RT_XINGDisallow level crossings for this road/tram (since OTTD r20049)
RT_HOUSDisallow construction of houses along this road/tram
RT_HIDEHide this road/tram type from construction menu (since OTTD 1.9)
RT_TOWNEnable road/tram type to be built by towns, picked by highest speed limits

roadtypename/tramtypename(<String>)

Text ID of the name of the road/tram type. For newGRF versions 7 or earlier, use this property function after property function toolbartext(), as this sets the road/tram type name as well for backwards compatibility.

required_list(<List::Label>)

This function defines a list of road/tram types that need to be available to the company of the player for this road/tram type to be introduced at (or after) the introduction date. This limit does not apply when the road/tram type is introduced by the introduction of a vehicle.

sortorder(<Byte>)

This function modifies the sort order for road/tram types in the construcion menu. By default, the sort oder is 0x10 * n + 7 for the n-th road/tram type.

toolbartext(<String>)

Text ID of the name of the road/tram type as shown in the toolbar caption.

vehwindowtext(<String>)

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.